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 pre-sign URL with aws s3 presign to get URL for secure share (access expires after some time)

Install AWS CLI with pip, in the terminal run:

pip install --upgrade --user awscli

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

Now we need to configure access to the AWS account:

./local/bin/aws configure

Enter your credentials from the AWS Web console

To get credentials I recommend creating 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 your bucket use s3 ls:

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

Image for hint

#aws #s3
9
Ivan Borshchov profile picture
Feb 15, 2017
by Ivan Borshchov
Did it help you?
Yes !
No

Best related