Monday, July 31, 2017

How to push local file to s3 using AWS CLI ?

Pre Steps :

- Install AWS CLI , Please visit the following post if you haven't installed already. (

Steps :

1) Create an user with access to s3 using aws IAM service.

i) Go to AWS console and search for service IAM

ii) Visit the Users section and click on "Add User"

iii) Enter the user name (for ex: s3-user or demo in my example) and check the Access Type as Programming Access and click "Next Permission"

iv) Attach Policy (so that user can access s3) by clicking "Attach Existing Policies directly".
Note : If you want you can create a group and attach user to the specific group having necessary permission.

v) Choose the policy "Amazons3FullAccess"

vi) Review and Click "Create User"

vii) Copy the access Key Id and Secret Access Key

2) Come to the Mac console and type "aws configure"and enter the keys details.

$ aws configure
AWS Access Key ID [****************QQNA]:
AWS Secret Access Key [****************GIel]:
Default region name [None]:
Default output format [None]:

3) s3 related commands -

Type the following command to see all the buckets created in s3

$ aws s3 ls
2017-07-30 20:09:09 raja-lamda-trigger-demo
2017-07-31 01:19:13 serverless-hello-world-d-serverlessdeploymentbuck-bib12jl57p6m

Create bucket

$ aws s3 mb s3://fst-demo-test
make_bucket: fst-demo-test
$ aws s3 ls | grep fst
2017-07-31 14:35:50 fst-demo-test

Check the AWS s3 console.

Remove Bucket

$ aws s3 rb s3://fst-demo-test
remove_bucket: fst-demo-test
$ aws s3 ls | grep fst

4) Copy local file to s3 bucket.

$ ls test.csv
$ aws s3 cp test.csv s3://fst-demo-test
upload: ./test.csv to s3://fst-demo-test/test.csv

List files in console

$ aws s3 ls s3://fst-demo-test
2017-07-31 14:42:30         24 test.csv

Check the aws s3 console


  1. Don’t follow your role model. Be the Role model person for others. But it's so simple by getting Hadoop training in Chennai. Because it is an assurance course to bounce back from a double salary. For joining call 7502633633.

  2. A really good post, very thankful and hopeful that you will write many more posts like this one.
    selenium training in chennai