• About Me
  • Projects
  • WebApp
  • Archive

Barnaby Baron. Exploring AWS.

  • Building an API Gateway and uploading files to S3 via Postman

Building an API Gateway and uploading files to S3 via Postman

2024-08-15 3 min read Projects Barny Baron

Journey: 📊 Community Builder 📊

Subject matter: Building on AWS

Task: Building an API Gateway and uploading files to S3 via Postman!

Using the 6 Pillars of the AWS Well-Architected Framework, Reliability will be achieved in this build.

This week, I built an API Gateway and uploaded files to an S3 bucket via the Postman platform.

Gateway

In the scenario where you have a front-end application but want to keep your back-end S3 bucket private, you can use an API Gateway in the middle to post files to S3.

For this project, I am using Postman to call my API with PUT requests.

I have chosen not to use a Cognito Authoriser in this instance, however it would be best practice to do so.

Uploading

Resource credit: This IaC architecture was created using guidance from Helio Tarnowski on Medium Here.

What did I use to build this environment?

  • AWS Management Console
  • Postman API Platform
  • IAM and JSON
  • CORS

What is built?

  • An S3 bucket
  • An API Gateway [REST API]

In this task, I created an S3 bucket and then created an IAM Role with permissions to allow API Gateway to push objects into S3.

I then created a REST API Gateway and configured it manually with a PUT Method and S3 as my AWS Service.

The HTTP method was configured as a PUT.

I used path overrides of bucket/filename so that I could replace my bucket name and object name placeholders when I came to use Postman.

After setting my URL path parameters, I was able to Deploy my API.

Before testing, I permitted media types to be allowed in the PUT request. To keep this simple, I used / to allow all files.

All I needed to do now was load up the Postman platform and test.

I obtained my Invoke URL from the Stages area in my API, replaced the {bucket} placeholder with my bucket name, and replaced {filename} with one of my stock photos. In this instance, it was called ‘binary.jpg’.

I added my photo to the Body of the Postman PUT request and clicked Send.

200 response showed in Postman citing a successful PUT.

I navigated back to my S3 bucket, refreshed it and there was my binary.jpg file uploaded from Postman, via my API Gateway.

To improve security on this in the future, I could add a Cognito Authoriser and use an access token in my Postman header!

Some of the highlights…

S3 Bucket:

S3

IAM Role:

IAM Role

API Gateway Resource:

API Gateway config

API Gateway Method:

API Stages

API Gateway Stages:

API Stages

Postman API successful:

PUT succeeding

S3 Bucket file uploaded:

S3 Bucket

My interpretation of the architecture:

Architecture

I hope you have enjoyed the article!

Cloud

Community Builder API Gateway S3
Latest posts
  • Designing a Formula 1 Race Track and gaining insights from Amazon Nova
  • Year 2 - AWS Community Builder
  • Troubleshooting an EKS Pod creation error - Persistent Volume Controller Failed Binding
  • Building an EKS cluster and mounting an S3 bucket within a pod using the CSI Driver
  • Sopra Steria Merch Delivery!
  • AWS Community Builders Application Window!
  • Building a VPC and provisioning an EC2 instance using Modules!
Categories
  • AWS News (84)
  • Projects (29)
  • Exploring (19)
  • Troubleshooting (10)
  • General (8)
  • Quotes (5)
  • Video (3)
Social media
Archive
© 2025 by Barny Baron
Powered by Bilberry Hugo Theme