Version: v1.25.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 12 Imported by: 0


AWS::Serverless::S3 Event Code Example

This example shows you how to get events of S3 bucket. When you upload an image in the source bucket it will resize that image and save in the destination bucket.


Don't forget to chnage S3 bucket name, source bucket prefix.

Package and deploy template


Run the following command to build binary of your code

GOOS=linux go build -o main

To package your application run the following command

sam package --template-file template.yaml --output-template-file serverless-output.yaml --s3-bucket <YOUR_S3_BUCKET>

It will validate the template, zip you applicaiton, upload to your S3 bucket and generates the output template. Replace the <YOUR_S3_BUCKET> with your bucket name.


Run the following command replacing <BUCKET_PREFIX> with your desire prefix name to deploye your application

sam deploy --template-file serverless-output.yaml --stack-name image-resizer --capabilities CAPABILITY_IAM --parameter-overrides BucketNamePrefix=<BUCKET_PREFIX>

It will create necessary resources and link them according to the template using cloudformation.


Upload an image in JPEG format to the SourceBucket defined in the template and verify the same image with smaller size in DestBucket.


The Go Gopher

There is no documentation for this package.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL