Skip to main content

AWS CLI

Generate Credentials

Navigate to the Access Keys page.

Access KeysAccess Keys

Click Create Access Key.

Create Access KeyCreate Access Key

Copy your Access Key, Secret Key to a safe location or download them.

Now you are ready to configure AWS CLI.

Configure AWS CLI with your credentials

Make sure AWS CLI is installed on your machine. To install it follow the instructions.

Verify your AWS CLI version by running aws --version in your terminal. AWS CLI current version is version 2. If you are using AWS CLI v1, you will need to install a plugin to be able to define the endpoint.

➜ ~ aws configure

AWS Access Key ID \[\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*7aua\]: <your-access-key\>

AWS Secret Access Key \[\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*lu2i\]: <your-secret-key\>

Default region name \[us-east-1\]:

Default output format \[None\]:

Make a Bucket

aws s3 --endpoint-url=https://s3.nodeshift.com mb s3://mycoolbucket

Display Buckets

aws s3 --endpoint-url=https://s3.nodeshift.com ls

Copy a file

aws s3 --endpoint-url=https://s3.nodeshift.com cp /tmp/file.zip s3://mycoolbucket

List files in the Bucket

aws s3 --endpoint-url=https://s3.nodeshift.com ls s3://mycoolbucket

Copy a file from the Bucket

aws s3 --endpoint-url=https://s3.nodeshift.com cp s3://mycoolbucket/file.zip /tmp/archive.zip

Delete the Bucket

aws s3 --endpoint-url=https://s3.nodeshift.com rb s3://mycoolbucket/

Delete a non-empty Bucket

aws s3 --endpoint-url=https://s3.nodeshift.com rb --force s3://mycoolbucket/