Creating an AWS S3 bucket via CLI

Amazon Simple Storage Service (Amazon S3) is an object storage service that prioritizes scalability, data availability, security, and performance. Buckets are containers for items; you specify the geographical location to store the bucket and who has access to the bucket's contents (making, viewing, and deleting objects in your bucket).

S3 has the following storage classes:

  • S3 Standard: stores frequently accessed data.
  • S3 Intelligent Tiering: stores data based on how frequently it is accessed.
  • S3 Standard Infrequent Access (S3 Standard-IA): stores data that is not frequently accessed but requires rapid access when needed.
  • S3 One-Zone IA: stores data that is accessed less frequently but requires rapid access when needed. S3 Glacier Instant Retrieval: stores data that is rarely accessed and requires milliseconds of retrieval.
  • S3 Glacier Deep Archive
  • S3 Glacier Flexible Retrieval

Bucket naming nomenclature can be found here.

  • Install the AWS CLI on your machine.

    $ sudo apt udpate
    $ sudo apt install awscli
    
  • Configure your AWS Access keys and Secret Access Key on your machine.

    $ aws configure
    
  • Create a bucket with a unique name.

    $ aws mb s3://bucketname --region your-region
    
  • To enforce an owner on the bucket, add the following code to the above command.

    --object-ownership BucketOwnerEnforced
    
  • To list items in the bucket, run the following:

    $ aws s3 ls <bucket-url>
    

Example

$ aws s3 mb s3://may4u --region us-east-1

Output

$ make_bucket: may4u

image

  • To delete the bucket,
    $ aws s3 rb s3://bucket-name --force
    

Thanks for your time!

Find me on LinkedIn