Amazon Simple Storage Service

Transcription

Amazon Simple Storage ServiceAPI ReferenceAPI Version 2006-03-01

Amazon Simple Storage Service API ReferenceAmazon Simple Storage Service: API ReferenceCopyright Amazon Web Services, Inc. and/or its affiliates. All rights reserved.Amazon's trademarks and trade dress may not be used in connection with any product or service that is notAmazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages ordiscredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who mayor may not be affiliated with, connected to, or sponsored by Amazon.

Amazon Simple Storage Service API ReferenceTable of ContentsAmazon S3 REST API Introduction . 1Amazon S3 API Reference . 3Actions . 3Amazon S3 . 7Amazon S3 Control . 444Amazon S3 on Outposts . 598Data Types . 609Amazon S3 . 614Amazon S3 Control . 794Amazon S3 on Outposts . 905Authenticating Requests (AWS Signature Version 4) . 909Authentication Methods . 910Introduction to Signing Requests . 910Using an Authorization Header . 911Overview . 911Signature Calculation: Transfer Payload in a Single Chunk . 914Signature Calculation: Transfer Payload in Multiple Chunks . 926Signature Calculation: Including Trailing Headers . 933Using Query Parameters . 937Calculating a Signature . 939An Example . 941Example 2 . 942Examples: Signature Calculations . 942Signature Calculation Examples Using Java . 943Signature Calculation Examples Using C# . 944Authenticating HTTP POST Requests . 944Calculating a Signature . 946Amazon S3 Signature Version 4 Authentication Specific Policy Keys . 947Bucket Policy Examples Using Signature Version 4 Related Condition Keys . 948Browser-Based Uploads Using POST . 951POST Object . 952Description . 952Versioning . 952Requests . 952Examples . 962Related Resources . 963POST Object restore . 964Description . 964Querying Archives with Select Requests . 964Restoring Archives . 965Requests . 966Responses . 975Examples . 976More Info . 978Browser-Based Uploads Using HTTP POST . 978Calculating a Signature . 979Creating HTML Forms . 980HTML Form Declaration . 980HTML Form Fields . 981POST Policy . 984Expiration . 985Condition Matching . 985Conditions . 986Character Escaping . 988API Version 2006-03-01iii

Amazon Simple Storage Service API ReferencePOST Upload Example . 990Uploading a File to Amazon S3 Using HTTP POST . 990Browser-Based Uploads Using AWS Amplify . 992Using the AWS Amplify JavaScript library to Upload Files to Amazon S3 . 992More Info . 993Common Request Headers . 994Common Response Headers . 996Error Responses . 998REST Error Responses . 998List of Error Codes . 999List of SELECT Object Content Error Codes . 1009List of Replication-Related Error Codes . 1016List of Amazon S3 on Outposts Error Codes . 1017List of Amazon S3 Storage Lens Error Codes . 1018List of Amazon S3 Object Lambda Error Codes . 1020List of Amazon S3 Asynchronous Error Codes . 1023AWS glossary . 1024Resources . 1025Document History . 1026Appendix . 1042Appendix: SelectObjectContent Response . 1043Description . 1043Responses . 1043Related Resources . 1052Appendix: OPTIONS object . 1053Description . 1053Requests . 1053Responses . 1054Examples . 1055Related Resources . 1055Appendix: SOAP API . 1055Operations on the Service (SOAP API) . 1056Operations on Buckets (SOAP API) . 1057Operations on Objects (SOAP API) . 1066SOAP Error Responses . 1082Appendix: Lifecycle Configuration APIs (Deprecated) . 1083PUT Bucket lifecycle (Deprecated) . 1085GET Bucket lifecycle (Deprecated) . 1095API Version 2006-03-01iv

Amazon Simple Storage Service API ReferenceAmazon S3 REST API IntroductionWelcome to the Amazon Simple Storage Service API Reference. This guide explains the Amazon SimpleStorage Service (Amazon S3) application programming interface (API). It describes various APIoperations, related request and response structures, and error codes. The current version of the AmazonS3 API is 2006-03-01.Amazon S3 supports the REST API.NoteSupport for SOAP over HTTP is deprecated, but it is still available over HTTPS. However, newAmazon S3 features will not be supported for SOAP. We recommend that you use either theREST API or the AWS SDKs.Read the following about authentication and access control before going to specific API topics.Requests to Amazon S3 can be authenticated or anonymous. Authenticated access requires credentialsthat AWS can use to authenticate your requests. When making REST API calls directly from your code,you create a signature using valid credentials and include the signature in your request. For informationabout various authentication methods and signature calculations, see Authenticating Requests (AWSSignature Version 4) (p. 909).Making REST API calls directly from your code can be cumbersome. It requires you to write the necessarycode to calculate a valid signature to authenticate your requests. We recommend the followingalternatives instead: Use the AWS SDKs to send your requests (see Sample Code and Libraries). With this option, youdon't need to write code to calculate a signature for request authentication because the SDK clientsauthenticate your requests by using access keys that you provide. Unless you have a good reason notto, you should always use the AWS SDKs. Use the AWS CLI to make Amazon S3 API calls. For information about setting up the AWS CLI andexample Amazon S3 commands see the following topics:Set Up the AWS CLI in the Amazon Simple Storage Service User Guide.Using Amazon S3 with the AWS Command Line Interface in the AWS Command Line Interface UserGuide.If you'd like to make your own REST API calls instead of using one of the above alternatives, there aresome things to keep in mind. The REST API uses standard HTTP headers and status codes, so standardbrowsers and toolkits work as expected. In some areas, we have added functionality to HTTP (forexample, we added headers to support access control). In these cases, we have done our best to add thenew functionality in a way that matches the style of standard HTTP usage. For more information aboutmaking requests, see Making requests in the Amazon Simple Storage Service User Guide. For additionaldetails about developing using REST APIs, see Developing with Amazon S3 using the REST API in theAmazon Simple Storage Service User Guide.You can have valid credentials to authenticate your requests, but unless you have permissions you cannotcreate or access Amazon S3 resources. For example, you must have permissions to create an S3 bucketor get an object from your bucket. If you use root credentials of your AWS account, you have all thepermissions. However, using root credentials is not recommended. Instead, we recommend that youAPI Version 2006-03-011

Amazon Simple Storage Service API Referencecreate IAM users in your account and manage user permissions. For more information, see ManagingAccess Permissions to Your Amazon S3 Resources in the Amazon Simple Storage Service User Guide.API Version 2006-03-012

Amazon Simple Storage Service API ReferenceActionsAmazon S3 API ReferenceThis section contains the Amazon S3 API Reference documentation. The Amazon S3 APIs are groupedinto three sets: Amazon Simple Storage Service, AWS S3 Control, and Amazon S3 on Outposts. There isno functional distinction between the three sets.In general, APIs that apply bucket- and object-level actions are in the Amazon Simple Storage Serviceset, and APIs that apply account-level actions are in the AWS S3 Control set. With Amazon S3 onOutposts, you can create S3 buckets on AWS Outposts and easily store and retrieve objects on premises.You communicate with your Outposts bucket using an access point and endpoint connection over avirtual private cloud (VPC). If you don't find an API that you're looking for in one set, check one of theother sets.ActionsThe following actions are supported by Amazon S3: AbortMultipartUpload (p. 10) CompleteMultipartUpload (p. 13) CopyObject (p. 21) CreateBucket (p. 34) CreateMultipartUpload (p. 41) DeleteBucket (p. 51) DeleteBucketAnalyticsConfiguration (p. 53) DeleteBucketCors (p. 55) DeleteBucketEncryption (p. 57) DeleteBucketIntelligentTieringConfiguration (p. 59) DeleteBucketInventoryConfiguration (p. 61) DeleteBucketLifecycle (p. 63) DeleteBucketMetricsConfiguration (p. 65) DeleteBucketOwnershipControls (p. 67) DeleteBucketPolicy (p. 69) DeleteBucketReplication (p. 71) DeleteBucketTagging (p. 73) DeleteBucketWebsite (p. 75) DeleteObject (p. 77) DeleteObjects (p. 82) DeleteObjectTagging (p. 90) DeletePublicAccessBlock (p. 93) GetBucketAccelerateConfiguration (p. 95) GetBucketAcl (p. 98) GetBucketAnalyticsConfiguration (p. 101) GetBucketCors (p. 105) GetBucketEncryption (p. 108)API Version 2006-03-013

Amazon Simple Storage Service API ReferenceActions GetBucketIntelligentTieringConfiguration (p. 111) GetBucketInventoryConfiguration (p. 114) GetBucketLifecycle (p. 118) GetBucketLifecycleConfiguration (p. 121) GetBucketLocation (p. 125) GetBucketLogging (p. 127) GetBucketMetricsConfiguration (p. 130) GetBucketNotification (p. 134) GetBucketNotificationConfiguration (p. 136) GetBucketOwnershipControls (p. 140) GetBucketPolicy (p. 143) GetBucketPolicyStatus (p. 146) GetBucketReplication (p. 149) GetBucketRequestPayment (p. 153) GetBucketTagging (p. 155) GetBucketVersioning (p. 158) GetBucketWebsite (p. 161) GetObject (p. 164) GetObjectAcl (p. 177) GetObjectAttributes (p. 182) GetObjectLegalHold (p. 187) GetObjectLockConfiguration (p. 189) GetObjectRetention (p. 191) GetObjectTagging (p. 193) GetObjectTorrent (p. 196) GetPublicAccessBlock (p. 199) HeadBucket (p. 202) HeadObject (p. 204) ListBucketAnalyticsConfigurations (p. 215) ListBucketIntelligentTieringConfigurations (p. 219) ListBucketInventoryConfigurations (p. 222) ListBucketMetricsConfigurations (p. 227) ListBuckets (p. 231) ListMultipartUploads (p. 233) ListObjects (p. 241) ListObjectsV2 (p. 249) ListObjectVersions (p. 259) ListParts (p. 270) PutBucketAccelerateConfiguration (p. 276) PutBucketAcl (p. 279) PutBucketAnalyticsConfiguration (p. 286) PutBucketCors (p. 290) PutBucketEncryption (p. 294) PutBucketIntelligentTieringConfiguration (p. 298) PutBucketInventoryConfiguration (p. 301)API Version 2006-03-014

Amazon Simple Storage Service API ReferenceActions PutBucketLifecycle (p. 306) PutBucketLifecycleConfiguration (p. 312) PutBucketLogging (p. 319) PutBucketMetricsConfiguration (p. 323) PutBucketNotification (p. 327) PutBucketNotificationConfiguration (p. 330) PutBucketOwnershipControls (p. 336) PutBucketPolicy (p. 340) PutBucketReplication (p. 343) PutBucketRequestPayment (p. 349) PutBucketTagging (p. 352) PutBucketVersioning (p. 355) PutBucketWebsite (p. 360) PutObject (p. 367) PutObjectAcl (p. 380) PutObjectLegalHold (p. 388) PutObjectLockConfiguration (p. 391) PutObjectRetention (p. 394) PutObjectTagging (p. 397) PutPublicAccessBlock (p. 401) RestoreObject (p. 405) SelectObjectContent (p. 414) UploadPart (p. 423) UploadPartCopy (p. 430) WriteGetObjectResponse (p. 438)The following actions are supported by Amazon S3 Control: CreateAccessPoint (p. 446) CreateAccessPointForObjectLambda (p. 450) CreateBucket (p. 453) CreateJob (p. 457) CreateMultiRegionAccessPoint (p. 463) DeleteAccessPoint (p. 466) DeleteAccessPointForObjectLambda (p. 468) DeleteAccessPointPolicy (p. 470) DeleteAccessPointPolicyForObjectLambda (p. 472) DeleteBucket (p. 474) DeleteBucketLifecycleConfiguration (p. 476) DeleteBucketPolicy (p. 478) DeleteBucketTagging (p. 480) DeleteJobTagging (p. 482) DeleteMultiRegionAccessPoint (p. 484) DeletePublicAccessBlock (p. 487) DeleteStorageLensConfiguration (p. 489) DeleteStorageLensConfigurationTagging (p. 491)API Version 2006-03-015

Amazon Simple Storage Service API ReferenceActions DescribeJob (p. 493) DescribeMultiRegionAccessPointOperation (p. 498) GetAccessPoint (p. 501) GetAccessPointConfigurationForObjectLambda (p. 505) GetAccessPointForObjectLambda (p. 507) GetAccessPointPolicy (p. 509) GetAccessPointPolicyForObjectLambda (p. 511) GetAccessPointPolicyStatus (p. 513) GetAccessPointPolicyStatusForObjectLambda (p. 515) GetBucket (p. 517) GetBucketLifecycleConfiguration (p. 520) GetBucketPolicy (p. 524) GetBucketTagging (p. 527) GetJobTagging (p. 530) GetMultiRegionAccessPoint (p. 532) GetMultiRegionAccessPointPolicy (p. 534) GetMultiRegionAccessPointPolicyStatus (p. 536) GetPublicAccessBlock (p. 538) GetStorageLensConfiguration (p. 541) GetStorageLensConfigurationTagging (p. 545) ListAccessPoints (p. 547) ListAccessPointsForObjectLambda (p. 550) ListJobs (p. 552) ListMultiRegionAccessPoints (p. 555) ListRegionalBuckets (p. 558) ListStorageLensConfigurations (p. 561) PutAccessPointConfigurationForObjectLambda (p. 563) PutAccessPointPolicy (p. 565) PutAccessPointPolicyForObjectLambda (p. 568) PutBucketLifecycleConfiguration (p. 571) PutBucketPolicy (p. 574) PutBucketTagging (p. 577) PutJobTagging (p. 580) PutMultiRegionAccessPointPolicy (p. 583) PutPublicAccessBlock (p. 586) PutStorageLensConfiguration (p. 589) PutStorageLensConfigurationTagging (p. 592) UpdateJobPriority (p. 594) UpdateJobStatus (p. 596)The following actions are supported by Amazon S3 on Outposts: CreateEndpoint (p. 599) DeleteEndpoint (p. 602) ListEndpoints (p. 604) ListSharedEndpoints (p. 607)API Version 2006-03-016

Amazon Simple Storage Service API ReferenceAmazon S3Amazon S3The following actions are supported by Amazon S3: AbortMultipartUpload (p. 10) CompleteMultipartUpload (p. 13) CopyObject (p. 21) CreateBucket (p. 34) CreateMultipartUpload (p. 41) DeleteBucket (p. 51) DeleteBucketAnalyticsConfiguration (p. 53) DeleteBucketCors (p. 55) DeleteBucketEncryption (p. 57) DeleteBucketIntelligentTieringConfiguration (p. 59) DeleteBucketInventoryConfiguration (p. 61) DeleteBucketLifecycle (p. 63) DeleteBucketMetricsConfiguration (p. 65) DeleteBucketOwnershipControls (p. 67) DeleteBucketPolicy (p. 69) DeleteBucketReplication (p. 71) DeleteBucketTagging (p. 73) DeleteBucketWebsite (p. 75) DeleteObject (p. 77) DeleteObjects (p. 82) DeleteObjectTagging (p. 90) DeletePublicAccessBlock (p. 93) GetBucketAccelerateConfiguration (p. 95) GetBucketAcl (p. 98) GetBucketAnalyticsConfiguration (p. 101) GetBucketCors (p. 105) GetBucketEncryption (p. 108) GetBucketIntelligentTieringConfiguration (p. 111) GetBucketInventoryConfiguration (p. 114) GetBucketLifecycle (p. 118) GetBucketLifecycleConfiguration (p. 121) GetBucketLocation (p. 125) GetBucketLogging (p. 127) GetBucketMetricsConfiguration (p. 130) GetBucketNotification (p. 134) GetBucketNotificationConfiguration (p. 136) GetBucketOwnershipControls (p. 140) GetBucketPolicy (p. 143) GetBucketPolicyStatus (p. 146) GetBucketReplication (p. 149) GetBucketRequestPayment (p. 153) GetBucketTagging (p. 155)API Version 2006-03-017

Amazon Simple Storage Service API ReferenceAmazon S3 GetBucketVersioning (p. 158) GetBucketWebsite (p. 161) GetObject (p. 164) GetObjectAcl (p. 177) GetObjectAttributes (p. 182) GetObjectLegalHold (p. 187) GetObjectLockConfiguration (p. 189) GetObjectRetention (p. 191) GetObjectTagging (p. 193) GetObjectTorrent (p. 196) GetPublicAccessBlock (p. 199) HeadBucket (p. 202) HeadObject (p. 204) ListBucketAnalyticsConfigurations (p. 215) ListBucketIntelligentTieringConfigurations (p. 219) ListBucketInventoryConfigurations (p. 222) ListBucketMetricsConfigurations (p. 227) ListBuckets (p. 231) ListMultipartUploads (p. 233) ListObjects (p. 241) ListObjectsV2 (p. 249) ListObjectVersions (p. 259) ListParts (p. 270) PutBucketAccelerateConfiguration (p. 276) PutBucketAcl (p. 279) PutBucketAnalyticsConfiguration (p. 286) PutBucketCors (p. 290) PutBucketEncryption (p. 294) PutBucketIntelligentTieringConfiguration (p. 298) PutBucketInventoryConfiguration (p. 301) PutBucketLifecycle (p. 306) PutBucketLifecycleConfiguration (p. 312) PutBucketLogging (p. 319) PutBucketMetricsConfiguration (p. 323) PutBucketNotification (p. 327) PutBucketNotificationConfiguration (p. 330) PutBucketOwnershipControls (p. 336) PutBucketPolicy (p. 340) PutBucketReplication (p. 343) PutBucketRequestPayment (p. 349) PutBucketTagging (p. 352) PutBucketVersioning (p. 355) PutBucketWebsite (p. 360) PutObject (p. 367) PutObjectAcl (p. 380) PutObjectLegalHold (p. 388)API Version 2006-03-018

Amazon Simple Storage Service API ReferenceAmazon S3 PutObjectLockConfiguration (p. 391) PutObjectRetention (p. 394) PutObjectTagging (p. 397) PutPublicAccessBlock (p. 401) RestoreObject (p. 405) SelectObjectContent (p. 414) UploadPart (p. 423) UploadPartCopy (p. 430) WriteGetObjectResponse (p. 438)API Version 2006-03-019

Amazon Simple Storage Service API ReferenceAmazon S3AbortMultipartUploadService: Amazon S3This action aborts a multipart upload. After a multipart upload is aborted, no additional parts can beuploaded using that upload ID. The storage consumed by any previously uploaded parts will be freed.However, if any part uploads are currently in progress, those part uploads might or might not succeed.As a result, it might be necessary to abort a given multipart upload multiple times in order to completelyfree all storage consumed by all parts.To verify that all parts have been removed, so you don't get charged for the part storage, you should callthe ListParts action and ensure that the parts list is empty.For information about permissions required to use the multipart upload, see Multipart Upload andPermissions.The following operations are related to AbortMultipartUpload: CreateMultipartUpload UploadPart CompleteMultipartUpload ListParts ListMultipartUploadsRequest SyntaxDELETE /Key ?uploadId UploadId HTTP/1.1Host: Bucket.s3.amazonaws.comx-amz-request-payer: RequestPayerx-amz-expected-bucket-owner: ExpectedBucketOwnerURI Request ParametersThe request uses the following URI parameters.Bucket (p. 10)The bucket name to which the upload was taking place.When using this action with an access point, you must direct requests to the access pointhostname. The access point hostname takes the form zonaws.com. When using this action with an access point through the AWSSDKs, you provide the access point ARN in place of the bucket name. For more information aboutaccess point ARNs, see Using access points in the Amazon S3 User Guide.When you use this action with Amazon S3 on Outposts, you must direct requeststo the S3 on Outposts hostname. The S3 on Outposts hostname takes the s.Region.amazonaws.com. Whenyou use this action with S3 on Outposts through the AWS SDKs, you provide the Outposts accesspoint ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Whatis S3 on Outposts in the Amazon S3 User Guide.Required: YesKey (p. 10)Key of the object for which the multipart upload was initiated.API Version 2006-03-0110

Amazon Simple Storage Service API ReferenceAmazon S3Length Constraints: Minimum length of 1.Required: YesuploadId (p. 10)Upload ID that identifies the multipart upload.Required: Yesx-amz-expected-bucket-owner (p. 10)The account ID of the expected bucket owner. If the bucket is owned by a different account, therequest fails with the HTTP status code 403 Forbidden (access denied).x-amz-request-payer (p. 10)Confirms that the requester knows that they will be charged for the request. Bucket owners neednot specify this parameter in their requests. For information about downloading objects fromRequester Pays buckets, see Downloading Objects in Requester Pays Buckets in the Amazon S3 UserGuide.Valid Values: requesterRequest BodyThe request does not have a request body.Response SyntaxHTTP/1.1 204x-amz-request-charged: RequestChargedResponse ElementsIf the action is successful, the service sends back an HTTP 204 response.The response returns the following HTTP headers.x-amz-request-charged (p. 11)If present, indicates that the requester was successfully charged for the request.Valid Values: requesterThe specified multipart upload does not exist.ExamplesSample RequestThe following request aborts a multipart upload identified by its upload ID.DELETE /example-object?uploadId VwbG9hZ HTTP/1.1Host: example-bucket.s3. Region .amazonaws.comDate: Mon, 1 Nov 2010 20:34:56 GMTAuthorization: authorization stringAPI Version 2006-03-0111

Amazon Simple Storage Service API ReferenceAmazon S3Sample ResponseThis example illustrates one usage of AbortMultipartUpload.HTTP/1.1 204 OKx-amz-id-2: aOFg x-amz-request-id: 996c76696e6727732072657175657374Date: Mon, 1 Nov 2010 20:34:56 GMTContent-Length: 0Connection: keep-aliveServer: AmazonS3See AlsoFor more informatio

into three sets: Amazon Simple Storage Service, AWS S3 Control, and Amazon S3 on Outposts. There is no functional distinction between the three sets. In general, APIs that apply bucket- and object-level actions are in the Amazon Simple Storage Service set, and APIs that apply account-level actions are in the AWS S3 Control set. With Amazon S3 on