Creating directory buckets with tags
You can tag Amazon S3 directory buckets when you create them. There is no additional charge for using tags on directory buckets beyond the standard S3 API request rates. For more information, see Amazon S3 pricing. For more information about tagging directory buckets, see Using tags with S3 directory buckets.
Permissions
To create a directory bucket with tags, you must have the following permissions:
-
s3express:CreateBucket
-
s3express:TagResource
Troubleshooting errors
If you encounter an error when attempting to create a directory bucket with tags, you can do the following:
Verify that you have the required Permissions to create the directory bucket and add a tag to it.
Check your IAM user policy for any attribute based access control (ABAC) conditions. You may be required to label your directory buckets only with specific tag keys and values. For more information, see Using tags for attribute based access control (ABAC).
Steps
You can create a directory bucket with tags applied by using the Amazon S3 console, the Amazon Command Line Interface (Amazon CLI), the Amazon S3 REST API, and Amazon SDKs.
To create a directory bucket with tags using the Amazon S3 console:
Sign in to Amazon S3 console at https://console.amazonaws.cn/s3/
. In the left navigation pane, choose directory buckets.
Choose create bucket to create a new directory bucket.
You can create two types of directory buckets:
Create a directory bucket in an Availability Zone for a high performance workload. For more information, see High performance workloads.
Create a directory bucket in a Local Zone for a data residency workload. For more information, see Data residency workloads.
For both types of directory buckets, on the Create bucket page, Tags is an option when creating a new directory bucket.
Choose Add new Tag to open the Tags editor and enter a tag key-value pair. The tag key is required, but the value is optional.
To add another tag, select Add new Tag again. You can enter up to 50 tag key-value pairs.
After you complete specifying the options for your new directory bucket, choose Create bucket.
For information about the Amazon S3 REST API support for creating a directory bucket with tags, see the following section in the Amazon Simple Storage Service API Reference:
To install the Amazon CLI, see Installing the Amazon CLI in the Amazon Command Line Interface User Guide.
The following CLI example shows how to create a directory bucket with tags by using the Amazon CLI. To use the command replace the user input placeholders
with your own information.
When you create a directory bucket you must provide configuration details and use the following naming convention:
bucket-base-name
--zone-id
--x-s3
Request:
aws s3api create-bucket \ --bucket
--
amzn-s3-demo-bucket--usw2-az1--x-s3
use1-az4
--x-s3 \ --create-bucket-configuration "Location={Type=AvailabilityZone,Name=use1-az4},Bucket={DataRedundancy=SingleAvailabilityZone,Type=Directory},Tags=[{Key=mykey
,Value=myvalue
}, {Key=mykey2
,Value=myvalue2
}]"
Response:
{ "Location": "http://bucket--
use1-az4
--x-s3.s3express-use1-az4
.us-east-1
.amazonaws.com/" }