Fast upload file to AWS S3 from scratch

To upload file to s3 you need:

  1. Install AWS CLI
  2. Configure AWS API access credentials (KEY and SECRET)
  3. Run aws s3 cp command
  4. Generate presign URL with aws s3 presign to get url for secure share (access expires after some time)

Install AWS CLI with pip, in terminal run:

pip install --upgrade --user awscli

You need python on Linux, or you can use python in cygwin on Windows)

Now we need configure access to AWS account:

./local/bin/aws configure

Enter your credentials from AWS Web console

To get credentials I recommend create a new user in AWS Console -> IAM, use Programmatic access only user, with S3FullAccess policy

Create a new bucket (name must be unique):

aws s3api create-bucket --bucket bucketname

Upload some file.zip :

./local/bin/aws s3 cp /path/to/file.zip  s3://bucketname/

Generate URL for 100 hours (means that it will expire after 100 hours):

~/.local/bin/aws s3 presign s3://bucketname/file.zip --expires-in 360000

To list files inside of yoor bucket use s3 ls:

./local/bin/aws s3 ls s3://bucketname/

#aws #s3
menu 9
Ivan Borshchov profile picture
Feb 15, 2017
by Ivan Borshchov

Best related

Other by Ivan Borshchov