Creating an AWS S3 (Simple Storage Service) Bucket using AWS CLI (Command Line Interface) is very easy and we can S3 Bucket using few AWS CLI commands.
sudo apt udpate
sudo apt install awscli
We need to check the AWS CLI version using the following command.
aws --version
Now we need to configure the AWS CLI with the following command. We need AWS Access Key ID, AWS Secret Access Key to configure the same.
aws configure
Now, we have configured AWS on our system. We can start using the AWS CLI. Use ‘aws’ command to get started. For example, using S3 commands, we can use ‘aws s3 help’
aws
aws s3 help
aws s3 ls
We can use s3api to create a bucket using AWS CLI
aws s3api help DESCRIPTION AVAILABLE COMMANDS o abort-multipart-upload o complete-multipart-upload o copy-object o create-bucket o create-multipart-upload o delete-bucket o delete-bucket-analytics-configuration o delete-bucket-cors o delete-bucket-encryption o delete-bucket-inventory-configuration o delete-bucket-lifecycle o delete-bucket-metrics-configuration o delete-bucket-policy o delete-bucket-replication o delete-bucket-tagging o delete-bucket-website o delete-object o delete-object-tagging o delete-objects o get-bucket-accelerate-configuration o get-bucket-acl o get-bucket-analytics-configuration o get-bucket-cors o get-bucket-encryption o get-bucket-inventory-configuration o get-bucket-lifecycle-configuration o get-bucket-location o get-bucket-logging o get-bucket-metrics-configuration o get-bucket-notification-configuration o get-bucket-policy o get-bucket-replication o get-bucket-request-payment o get-bucket-tagging o get-bucket-versioning o get-bucket-website o get-object o get-object-acl o get-object-tagging o get-object-torrent o head-bucket o head-object o help o list-bucket-analytics-configurations o list-bucket-inventory-configurations o list-bucket-metrics-configurations o list-buckets o list-multipart-uploads o list-object-versions o list-objects o list-objects-v2 o list-parts o put-bucket-accelerate-configuration o put-bucket-acl o put-bucket-analytics-configuration o put-bucket-cors o put-bucket-encryption o put-bucket-inventory-configuration o put-bucket-lifecycle-configuration o put-bucket-logging o put-bucket-metrics-configuration o put-bucket-notification-configuration o put-bucket-policy o put-bucket-replication o put-bucket-request-payment o put-bucket-tagging o put-bucket-versioning o put-bucket-website o put-object o put-object-acl o put-object-tagging o restore-object o upload-part o upload-part-copy o wait
Run the following command to create a sample bucket on us-east-1 region.
aws s3api create-bucket --bucket test-bucket-989282 --region us-east-1
The output will be like:
“Location”: /test-bucket-989282 (The bucket name provided)
We can also perform several operations like list, get, put, delete objects and buckets depending upon our requirements.
Also, read Create an AWS VPC Peering Connection