The aws s3 mb command is a part of the AWS Command Line Interface (CLI) and is used to create S3 buckets. Amazon S3 (Simple Storage Service) is an object storage service provided by Amazon Web Services that allows you to store and retrieve large amounts of data.
Here’s an overview of the aws s3 mb command and its functionality:
- Creating a Bucket: The primary purpose of the aws s3 mb command is to create an S3 bucket. You specify a globally unique bucket name as an argument, and AWS will create a new bucket with that name in your AWS account.
- Bucket Naming Rules: When creating an S3 bucket, there are certain rules and restrictions for the bucket name. The name must be unique across all existing bucket names in Amazon S3, and it must adhere to DNS naming conventions (e.g., no uppercase letters, no special characters except for periods and hyphens). The bucket name must also follow a specific format, such as “my-bucket-name” or “example.com”.
- Bucket Location: By default, when you create an S3 bucket using the aws s3 mb command, AWS will automatically choose the optimal region to host the bucket based on your AWS configuration. However, you can specify a specific region using the –region option if needed.
- Access Control: By default, the bucket created using the aws s3 mb command will have private access. You can later configure access control permissions and policies to define who can access the bucket and its contents.
- Bucket URL: Once the bucket is created, it will have a unique URL in the format https://
.s3.amazonaws.com. This URL can be used to access and interact with the bucket programmatically or through web interfaces.
The aws s3 mb command provides a convenient way to create S3 buckets directly from the command line. It allows you to automate the bucket creation process and integrate it into your scripts or workflows.
aws s3 mb Command Examples
1. Create an S3 bucket:
# aws s3 mb s3://bucket_name
2. Create an S3 bucket in a specific region:
# aws s3 mb s3://bucket_name --region region
3. Display help:
# aws s3 mb help