Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Serverless Architectures

You're reading from   Building Serverless Architectures Unleash the power of AWS Lambdas for your applications

Arrow left icon
Product type Paperback
Published in Jul 2017
Publisher Packt
ISBN-13 9781787129191
Length 242 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Cagatay Gurturk Cagatay Gurturk
Author Profile Icon Cagatay Gurturk
Cagatay Gurturk
Arrow right icon
View More author details
Toc

Letting users upload to S3

As the second part of this picture-resizing system, we need to create an endpoint that will let our users upload their pictures to the S3 bucket. As we explained at the beginning, there is no need to develop any custom software for that because API Gateway, besides executing Lambda functions, also lets us expose some of AWS APIs to public the internet. It means, we can let API Gateway clients use the S3 upload API on our behalf.

How can we configure this? First, we have to create a new role that can be assumed by API Gateway and only grants s3:PutObject and s3:PutObjectAcl permissions to our profile pictures bucket. Let's add this permission to our Resources section of the CloudFormation template:

"ApiGatewayProxyRole": { 
  "Type": "AWS::IAM::Role", 
    "Properties": { 
      "AssumeRolePolicyDocument...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime