Try it now and let us know what you think. Switch to the new look >>
You can return to the original look by selecting English in the language selector above.
PUT Bucket inventory
Description
This implementation of the PUT operation adds an inventory configuration
(identified by the inventory ID) to the bucket. You can have up to 1,000 inventory
configurations per bucket.
Amazon S3 inventory generates inventories of the objects in the bucket on a daily or weekly basis, and the results are published to a flat file. The bucket that is inventoried is called the source bucket, and the bucket where the inventory flat file is stored is called the destination bucket. The destination bucket must be in the same AWS Region as the source bucket.
When you configure an inventory for a source bucket, you specify the destination bucket where you want the inventory to be stored, and whether to generate the inventory daily or weekly. You can also configure what object metadata to include and whether to inventory all object versions or only current versions. For more information, see Amazon S3 Inventory in the Amazon Simple Storage Service Developer Guide.
Important
You must create a bucket policy on the destination bucket to grant permissions to Amazon S3 to write objects to the bucket in the defined location. For an example policy, see Granting Permissions for Amazon S3 Inventory and Storage Class Analysis.
To use this operation, you must have permissions to perform the
s3:PutInventoryConfiguration action. The bucket owner has this
permission by default and can grant this permission to others. For more information
about permissions, see Permissions Related to Bucket Subresource Operations and Managing Access Permissions to Your Amazon S3
Resources in the Amazon Simple Storage Service Developer Guide.
Requests
Syntax
PUT /?inventory&id=configuration-IDHTTP/1.1 Host:bucketname.s3.amazonaws.com Content-Length:lengthDate:dateAuthorization:authorization string(see Authenticating Requests (AWS Signature Version 4))Inventory configuration in the request body
Request Parameters
This implementation of PUT uses the parameter in the following
table.
| Parameter | Description | Required |
|---|---|---|
id |
The ID identifying the inventory configuration. This ID must match the request element
Type: String Default: None Valid Characters for |
Yes |
Request Headers
This implementation of the operation uses only request headers that are common to all operations. For more information, see Common Request Headers.
Request Elements
In the request, you must specify the inventory configuration in the request body, which is specified as XML. The Examples section shows an example of an inventory configuration.
The following table describes the XML elements in the inventory configuration:
| Name | Description | Required |
|---|---|---|
AccountId
|
The ID of the account that owns the destination bucket. Although optional, we recommend that the value be set to prevent problems if the destination bucket ownership changes. Type: String Ancestor: |
No |
Bucket
|
The Amazon Resource Name (ARN) of the bucket where inventory results are published. This destination bucket must be in the same AWS Region as the source bucket. Type: String Ancestor: |
Yes |
Destination
|
Contains information about where to publish the inventory results. Type: Container Children: Ancestor: |
Yes |
Encryption
|
Contains the type of server-side encryption to use to encrypt the inventory. Type: Container Children: Ancestor: |
No |
Field
|
Contains the optional fields that are included in the inventory results. Multiple
Type: String Ancestor: Valid values: |
No |
Filter
|
Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria. If no filter is specified, all of the contents of the bucket are inventoried. Type: Container Children: Ancestor: |
No |
Format
|
Specifies the output format of the inventory results. Currently, Amazon S3 supports the comma-separated values (CSV) format, the Apache optimized row columnar (ORC) format, and the Apache Parquet (Parquet) format. Type: String Ancestor: Valid values: |
Yes |
Frequency
|
Specifies how frequently inventory results are produced. Type: String Ancestor: Valid values: |
Yes |
Id
|
The ID identifying the inventory configuration. This ID must
match the request parameter Type: String Ancestor: |
Yes |
IncludedObjectVersions
|
Specifies which object versions to include in the inventory
results. If set to Type: String Ancestor: Valid values: |
Yes |
InventoryConfiguration
|
Contains the inventory configuration. Type: Container Children: Ancestor: None |
Yes |
IsEnabled |
Specifies whether the inventory is enabled or disabled. If set to Type: String Ancestor: Valid values: |
Yes |
KeyId
|
The AWS KMS customer master key (CMK) used to encrypt the inventory file. Type: String Ancestor: Valid values: ARN of the CMK |
No |
OptionalFields
|
Contains the optional fields that are included in the inventory results. Type: Container Children: Ancestor: |
No |
Prefix
|
The prefix that an object must have to be included in the inventory results. Type: String Ancestor: |
No |
Prefix
|
The prefix that is prepended to all inventory results. Type: String Ancestor: |
No |
Schedule
|
Contains the frequency for generating inventory results. Type: Container Children: Ancestor: |
Yes |
SSE-KMS
|
Specifies to use server-side encryption with AWS KMS-managed keys (SSE-KMS) and contains the key that is used to encrypt the inventory file. Type: Container Children: Ancestor: |
No |
SSE-S3
|
Specifies to use server-side encryption with Amazon S3-managed keys (SSE-S3) to encrypt the inventory file. Type: Container Ancestor: Valid values: empty |
No |
S3BucketDestination
|
Contains the bucket ARN, file format, bucket owner (optional), prefix where inventory results are published (optional), and the type of server-side encryption that is used to encrypt the file (optional). Type: Container Children: Ancestor: |
Yes |
Responses
Response Headers
This implementation of the operation uses only response headers that are common to most responses. For more information, see Common Response Headers.
Response Elements
This implementation of the operation does not return response elements.
Special Errors
Amazon S3 checks the validity of the proposed InventoryConfiguration element and
verifies whether the proposed configuration is valid when you call the
PUT operation. The following table lists the errors and possible
causes.
| HTTP Error | Code | Cause |
|---|---|---|
HTTP 400 Bad Request |
InvalidArgument |
Invalid argument. |
HTTP 400 Bad Request |
TooManyConfigurations |
You are attempting to create a new configuration but have already reached the 1,000-configuration limit. |
HTTP 403 Forbidden |
AccessDenied |
You are not the owner of the specified bucket, or you do not have the
|
For general information about Amazon S3 errors and a list of error codes, see Error Responses.
Examples
Example 1: Creating an Inventory Configuration
The following PUT request for the bucket examplebucket creates a
new or replaces an existing inventory configuration with the ID
report1. The configuration is defined in the request body.
PUT /?inventory&id=report1 HTTP/1.1 Host: examplebucket.s3.amazonaws.com Date: Mon, 31 Oct 2016 12:00:00 GMT Authorization:authorization stringContent-Length:length<?xml version="1.0" encoding="UTF-8"?> <InventoryConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Id>report1</Id> <IsEnabled>true</IsEnabled> <Filter> <Prefix>filterPrefix/</Prefix> </Filter> <Destination> <S3BucketDestination> <Format>CSV</Format> <AccountId>123456789012</AccountId> <Bucket>arn:aws:s3:::destination-bucket</Bucket> <Prefix>prefix1</Prefix> <Encryption> <SSE-KMS> <KeyId>arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab</KeyId> </SSE-KMS> </Encryption> </S3BucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <IncludedObjectVersions>All</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>ReplicationStatus</Field> <Field>EncryptionStatus</Field> <Field>ObjectLockRetainUntilDate</Field> <Field>ObjectLockMode</Field> <Field>ObjectLockLegalHoldStatus</Field> </OptionalFields> </InventoryConfiguration>
The following is a sample response.
HTTP/1.1 200 OK x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo x-amz-request-id: 236A8905248E5A01 Date: Mon, 31 Oct 2016 12:00:00 GMT Content-Length: 0 Server: AmazonS3


