Step-By-Step Guide: Accessing S3 objects via S3 Pre-signed URLs

Accessing S3 objects via S3 Pre-signed URLs generated using Python Flask Server deployed on Amazon Ec2 instance.

High-level Architecture

Step 0. Create an S3 bucket, copy the Image file and the code

a. Create an S3 bucket named pre-signed-url-bucket

b. Create a file on your local with the following content

c. Copy the file and the image sample.png to pre-signed-url-bucket

Step 1. Launch an EC2 Instance

a. Launch an EC2 instance with the following config

Name: Flask Server

b. Create a Key pair with pem extension

c. Create a Security Group and a Security Group Rule to allow incoming SSH and Custom TCP (port 5000) traffic

d. Launch Instance

Step 2. Connect and Install Python and Virtualenv on E2 Instance

a. Connect to the EC2 Instance


c. Install Python and Virtualenv

Step 3. Copy the image file and the code from S3 to the EC2 instance


If you get “fatal error: Unable to locate credentials” try running the following and check the output

if the credentials are not set, set the credentials using the following command

Step 4. Run your Flask Web Application Server

Step 5. Access the Image from the browser


Rate this post

Leave a Reply