Create S3 Bucket from AWS / EC2 / Jump Server

Without leaving the AWS CLI, you can create a bucket after you have the necessary permissions to read and write S3 buckets.

Using your EC2 instance, jump server, or AWS Cli, the following command helps create an S3 bucket.

To check if you can access the S3, execute the below command.

aws s3 ls

It will return the list of the buckets from S3.

The following error indicates that you do not have the required rights on S3 buckets.
ls: cannot access s3-mysql-bucket: Transport endpoint is not connected.

If you are trying to copy or move files you’ll see the following error.
An error occurred (InvalidAccessKeyId) when calling the PutObject operation: The AWS Access Key Id you provided does not exist in our records.

Once you have access, execute the following to create the buckets.
aws s3api create-bucket –bucket test-bucket –region us-east-2

Please use a name that S3 can accept because S3 bucket names must be globally unique. If the name is already claimed by someone else, an error will be thrown.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s