Fast upload file to AWS S3 from scratch

Today, 27th January 2023, Ukraine is still bravely fighting for democratic values, human rights and peace in whole world. Russians ruthlessly kill all civilians in Ukraine including childs and destroy their cities. We are uniting against Putin’s invasion and violence, in support of the people in Ukraine. You can help by donating to Ukrainian's army.

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):

./local/bin/aws s3api create-bucket --bucket bucketname

Upload some :

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

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

~/.local/bin/aws s3 presign s3://bucketname/ --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
Ivan Borshchov profile picture
Feb 15, 2017
by Ivan Borshchov
Did it help you?
Yes !

Best related