S3¶
Installation¶
To install the S3 client:
Client¶
AsyncS3Client
¶
Bases: AsyncClient[AsyncS3Config]
Note
For information about using the Amazon S3 API---including authentication, signing requests, code examples, and error handling---see the Amazon S3 Developer Guide.
Welcome to the Amazon S3 API Reference. This guide explains the Amazon Simple Storage Service (Amazon S3) application programming interface (API).
Welcome to the Amazon S3 API Reference. This guide explains the Amazon Simple Storage Service (Amazon S3) application programming interface (API).
You can use any toolkit that supports HTTP to use the REST API. You can even use a browser to fetch objects, as long as they are anonymously readable.
The REST API uses the standard HTTP headers and status codes, so that standard browsers and toolkits work as expected. In some areas, we have added functionality to HTTP (for example, we added headers to support access control). In these cases, we have done our best to add the new functionality in a way that matched the style of standard HTTP usage.
The current version of the Amazon S3 API is 2006-03-01.
Amazon S3 supports the REST API.
Note
Support for SOAP over HTTP is deprecated, but it is still available over HTTPS. However, new Amazon S3 features will not be supported for SOAP. We recommend that you use either this REST API or the Amazon Web Services SDKs.
Operations¶
abort_multipart_uploadcomplete_multipart_uploadcopy_objectcreate_bucketcreate_bucket_metadata_configurationcreate_bucket_metadata_table_configurationcreate_multipart_uploadcreate_sessiondelete_bucketdelete_bucket_analytics_configurationdelete_bucket_corsdelete_bucket_encryptiondelete_bucket_intelligent_tiering_configurationdelete_bucket_inventory_configurationdelete_bucket_lifecycledelete_bucket_metadata_configurationdelete_bucket_metadata_table_configurationdelete_bucket_metrics_configurationdelete_bucket_ownership_controlsdelete_bucket_policydelete_bucket_replicationdelete_bucket_taggingdelete_bucket_websitedelete_objectdelete_object_annotationdelete_object_taggingdelete_objectsdelete_public_access_blockget_bucket_abacget_bucket_accelerate_configurationget_bucket_aclget_bucket_analytics_configurationget_bucket_corsget_bucket_encryptionget_bucket_intelligent_tiering_configurationget_bucket_inventory_configurationget_bucket_lifecycle_configurationget_bucket_locationget_bucket_loggingget_bucket_metadata_configurationget_bucket_metadata_table_configurationget_bucket_metrics_configurationget_bucket_notification_configurationget_bucket_ownership_controlsget_bucket_policyget_bucket_policy_statusget_bucket_replicationget_bucket_request_paymentget_bucket_taggingget_bucket_versioningget_bucket_websiteget_objectget_object_aclget_object_annotationget_object_attributesget_object_legal_holdget_object_lock_configurationget_object_retentionget_object_taggingget_object_torrentget_public_access_blockhead_buckethead_objectlist_bucket_analytics_configurationslist_bucket_intelligent_tiering_configurationslist_bucket_inventory_configurationslist_bucket_metrics_configurationslist_bucketslist_directory_bucketslist_multipart_uploadslist_object_annotationslist_object_versionslist_objectslist_objects_v2list_partsput_bucket_abacput_bucket_accelerate_configurationput_bucket_aclput_bucket_analytics_configurationput_bucket_corsput_bucket_encryptionput_bucket_intelligent_tiering_configurationput_bucket_inventory_configurationput_bucket_lifecycle_configurationput_bucket_loggingput_bucket_metrics_configurationput_bucket_notification_configurationput_bucket_ownership_controlsput_bucket_policyput_bucket_replicationput_bucket_request_paymentput_bucket_taggingput_bucket_versioningput_bucket_websiteput_objectput_object_aclput_object_annotationput_object_legal_holdput_object_lock_configurationput_object_retentionput_object_taggingput_public_access_blockrename_objectrestore_objectselect_object_contentupdate_bucket_metadata_annotation_table_configurationupdate_bucket_metadata_inventory_table_configurationupdate_bucket_metadata_journal_table_configurationupdate_object_encryptionupload_partupload_part_copywrite_get_object_response
Configuration¶
AsyncS3Config
dataclass
¶
Bases: AsyncAwsConfig
S3 configuration (async-resolved).
Attributes¶
auth_scheme_resolver
class-attribute
instance-attribute
¶
An auth scheme resolver that determines the auth scheme for each operation.
auth_schemes
class-attribute
instance-attribute
¶
A map of auth scheme ids to auth schemes.
aws_access_key_id
class-attribute
instance-attribute
¶
aws_access_key_id: str | None = None
The identifier for a secret access key.
aws_credentials_identity_resolver
class-attribute
instance-attribute
¶
aws_credentials_identity_resolver: AsyncIdentityResolver[AWSCredentialsIdentity, AWSIdentityProperties] | None = None
Resolves AWS Credentials. Required for operations that use Sigv4 Auth.
aws_secret_access_key
class-attribute
instance-attribute
¶
aws_secret_access_key: str | None = None
A secret access key that can be used to sign requests.
aws_session_token
class-attribute
instance-attribute
¶
aws_session_token: str | None = None
The session token used with temporary AWS credentials.
disable_multi_region_access_points
class-attribute
instance-attribute
¶
disable_multi_region_access_points: bool | None = None
Disables this client's usage of Multi-Region Access Points.
disable_s3_express_session_auth
class-attribute
instance-attribute
¶
disable_s3_express_session_auth: bool | None = None
Disables this client's usage of Session Auth for S3Express buckets and reverts to using conventional SigV4 for those.
endpoint_resolver
class-attribute
instance-attribute
¶
The endpoint resolver used to resolve the final endpoint per-operation based on the configuration.
force_path_style
class-attribute
instance-attribute
¶
force_path_style: bool | None = None
Forces this client to use path-style addressing for buckets.
interceptors
class-attribute
instance-attribute
¶
The list of interceptors, which are hooks that are called during the execution of a request.
protocol
class-attribute
instance-attribute
¶
Pass a protocol class reference from smithy_aws_core.aio.protocols to select the protocol, e.g. protocol=AsyncAwsJson10ClientProtocol. For custom protocols a protocol instance may also be passed.
region
class-attribute
instance-attribute
¶
region: str | None = None
The AWS region to connect to. The configured region is used to determine the service endpoint.
request_checksum_calculation
class-attribute
instance-attribute
¶
When to calculate checksums of request payloads: when_supported
(the default) calculates them for every operation that supports request
checksums, and when_required only when the operation requires
one or an algorithm is set on the request, such as with
checksum_algorithm. A checksum set on the request is sent as is.
response_checksum_validation
class-attribute
instance-attribute
¶
When to validate the checksums of response payloads:
when_supported (the default) validates them for every operation
that models response checksums, and when_required only when
validation is enabled on the request, such as with
checksum_mode. A payload is validated when it's read to the
end, and a mismatch raises ChecksumMismatchError.
sdk_ua_app_id
class-attribute
instance-attribute
¶
sdk_ua_app_id: str | None = None
A unique and opaque application ID that is appended to the User-Agent header.
use_accelerate_endpoint
class-attribute
instance-attribute
¶
use_accelerate_endpoint: bool | None = None
Enables this client to use S3 Transfer Acceleration endpoints.
use_arn_region
class-attribute
instance-attribute
¶
use_arn_region: bool | None = None
Enables this client to use an ARN's region when constructing an endpoint instead of the client's configured region.
use_dualstack_endpoint
class-attribute
instance-attribute
¶
use_dualstack_endpoint: bool | None = None
When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.
use_fips_endpoint
class-attribute
instance-attribute
¶
use_fips_endpoint: bool | None = None
When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
user_agent_extra
class-attribute
instance-attribute
¶
user_agent_extra: str | None = None
Additional suffix to be added to the User-Agent header.
Methods:¶
resolve
async
classmethod
¶
resolve(*, profile: str | None = None, fs: AsyncFileSystem | None = None, config_file_path: str | None = None, credentials_file_path: str | None = None, **overrides: Unpack[_AsyncS3ConfigOverrides]) -> Self
Resolve config from environment, config files, defaults, and explicit overrides.
Plugin
module-attribute
¶
Plugin: TypeAlias = Callable[[AsyncS3Config], None]
A callable that customizes a client configuration. Service-level plugins are applied once to the base configuration inherited by every operation. Operation-level plugins apply only to a single operation invocation.
Structures¶
AbacStatusAbortIncompleteMultipartUploadAccelerateConfigurationAccessControlPolicyAccessControlTranslationAnalyticsAndOperatorAnalyticsConfigurationAnalyticsExportDestinationAnalyticsS3BucketDestinationAnnotationEntryAnnotationTableConfigurationAnnotationTableConfigurationResultAnnotationTableConfigurationUpdatesBlockedEncryptionTypesBucketBucketInfoBucketLifecycleConfigurationBucketLoggingStatusCORSConfigurationCORSRuleCSVInputCSVOutputChecksumCommonPrefixCompletedMultipartUploadCompletedPartConditionContinuationEventCopyObjectResultCopyPartResultCreateBucketConfigurationDefaultRetentionDeleteDeleteMarkerEntryDeleteMarkerReplicationDeletedObjectDestinationDestinationResultEncryptionEncryptionConfigurationEndEventErrorErrorDetailsErrorDocumentEventBridgeConfigurationEventHoldDurationExistingObjectReplicationFilterRuleGetBucketMetadataConfigurationResultGetBucketMetadataTableConfigurationResultGetObjectAttributesPartsGlacierJobParametersGrantGranteeIndexDocumentInitiatorInputSerializationIntelligentTieringAndOperatorIntelligentTieringConfigurationIntelligentTieringFilterInventoryConfigurationInventoryDestinationInventoryEncryptionInventoryFilterInventoryS3BucketDestinationInventoryScheduleInventoryTableConfigurationInventoryTableConfigurationResultInventoryTableConfigurationUpdatesJSONInputJSONOutputJournalTableConfigurationJournalTableConfigurationResultJournalTableConfigurationUpdatesLambdaFunctionConfigurationLifecycleExpirationLifecycleRuleLifecycleRuleAndOperatorLifecycleRuleFilterLocationInfoLoggingEnabledMetadataConfigurationMetadataConfigurationResultMetadataEntryMetadataTableConfigurationMetadataTableConfigurationResultMetadataTableEncryptionConfigurationMetricsMetricsAndOperatorMetricsConfigurationMultipartUploadNoncurrentVersionExpirationNoncurrentVersionTransitionNotificationConfigurationNotificationConfigurationFilterObjectObjectIdentifierObjectLockConfigurationObjectLockLegalHoldObjectLockRetentionObjectLockRuleObjectPartObjectVersionOutputLocationOutputSerializationOwnerOwnershipControlsOwnershipControlsRuleParquetInputPartPartitionedPrefixPolicyStatusProgressProgressEventPublicAccessBlockConfigurationQueueConfigurationRecordExpirationRecordsEventRedirectRedirectAllRequestsToReplicaModificationsReplicationConfigurationReplicationRuleReplicationRuleAndOperatorReplicationRuleFilterReplicationTimeReplicationTimeValueRequestPaymentConfigurationRequestProgressRestoreRequestRestoreStatusRoutingRuleS3KeyFilterS3LocationS3TablesDestinationS3TablesDestinationResultSSEKMSSSEKMSEncryptionSSES3ScanRangeSelectParametersServerSideEncryptionByDefaultServerSideEncryptionConfigurationServerSideEncryptionRuleSessionCredentialsSimplePrefixSourceSelectionCriteriaSseKmsEncryptedObjectsStatsStatsEventStorageClassAnalysisStorageClassAnalysisDataExportTagTaggingTargetGrantTargetObjectKeyFormatTieringTopicConfigurationTransitionVersioningConfigurationWebsiteConfiguration
Errors¶
AccessDeniedAnnotationLimitExceededAnnotationNameTooLongBucketAlreadyExistsBucketAlreadyOwnedByYouEncryptionTypeMismatchIdempotencyParameterMismatchInvalidAnnotationNameInvalidObjectStateInvalidPrefixInvalidRequestInvalidWriteOffsetNoSuchAnnotationNoSuchBucketNoSuchKeyNoSuchUploadNotFoundObjectAlreadyInActiveTierErrorObjectNotInActiveTierErrorServiceErrorTooManyPartsUnsupportedMediaType
Unions¶
Enums¶
AnalyticsS3ExportFileFormatAnnotationConfigurationStateAnnotationDirectiveArchiveStatusBucketAbacStatusBucketAccelerateStatusBucketCannedACLBucketLocationConstraintBucketLogsPermissionBucketNamespaceBucketTypeBucketVersioningStatusChecksumAlgorithmChecksumModeChecksumTypeCompressionTypeDataRedundancyDeleteMarkerReplicationStatusEncodingTypeEncryptionTypeEventExistingObjectReplicationStatusExpirationStateExpirationStatusExpressionTypeFileHeaderInfoFilterRuleNameIntelligentTieringAccessTierIntelligentTieringStatusInventoryConfigurationStateInventoryFormatInventoryFrequencyInventoryIncludedObjectVersionsInventoryOptionalFieldJSONTypeLocationTypeMFADeleteMFADeleteStatusMetadataDirectiveMetricsStatusObjectAttributesObjectCannedACLObjectLockEnabledObjectLockEventHoldObjectLockLegalHoldStatusObjectLockModeObjectLockRetentionModeObjectOwnershipObjectStorageClassObjectVersionStorageClassOptionalObjectAttributesOwnerOverridePartitionDateSourcePayerPermissionProtocolQuoteFieldsReplicaModificationsStatusReplicationRuleStatusReplicationStatusReplicationTimeStatusRequestChargedRequestPayerRestoreRequestTypeS3TablesBucketTypeServerSideEncryptionSessionModeSseKmsEncryptedObjectsStatusStorageClassStorageClassAnalysisSchemaVersionTableSseAlgorithmTaggingDirectiveTierTransitionDefaultMinimumObjectSizeTransitionStorageClassType