Publishing an App to AWS Serverless Application Repo — My Experience

Chris Plankey
Jan 20 · 3 min read

Earlier today I had a need for a simple Lambda that could backup my Dynamo table to S3. Hoping to make it happen as fast as possible, I searched AWS’s Serverless Application Repo (SAR), but no luck.


I decided that was going to change.


First things first, I have been using AWS for 3+ years and with the exception of a couple of POCs for Hackathons or a fork of a random repo, I’ve never really had a need to use AWS Serverless Application Model (SAM). Personally, I am a bigger fan of the Serverless Framework. But it turns out you can’t publish to the SAR without using SAM, so it looks like I need to learn a thing or two before contributing…

I started with this tutorial…But retrospectively, this one probably would have done me better:

I got caught up on a couple of things by not using the second tutorial and all my reasons for not using it were due to me just wanting to hack this together as fast as possible…jokes on me.

The first reason I didn’t use the second tutorial was that I noticed the console UI for publishing provided license files, but if I used the CLI, I needed to have one locally. Well that didn’t work out so great for me anyways because it turns out I didn’t add my name or copyright year to the template and had to pull my app down and republish after I realized my mistake.

The second reason was that I didn’t want to create another directory and create a new SAM template to deploy the app, I thought one SAM project was enough for the day.

Well long story short, I spent way more time trying to troubleshoot issues with tutorial one than I would have if I used tutorial two


One of the first issues I ran into was building SAM locally. I needed to provide the input variables that a user would provide from SAR. Google was my friend here, I just needed the --paramater-overrides flag:

sam build --parameter-overrides 'BucketNameParameter=backupbucket, TableNameParameter=table-to-backup'

Next was that when I built with SAM, the S3 bucket for the source code was relative to my project. I needed to overwrite the SAM injected value with the path to an uploaded artifact in S3 after ever build.

Also, I had to zip up app.js after running sam build and put it in a public S3 bucket so others could consume it. This means that every time I made a code change, I needed to run sam build , compress the artifact it generates, upload it to S3, and change the S3 path in the generated template.yaml. Absolutely a place to introduce some CI/CD…but not today…

The best mistake I made when learning about SAM was if you’re trying to learn about IAM integrations with SAM, do not Google SAM IAM unless you want to enter a Dr. Seuss rabbit hole…

Instead, use this link: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-policy-templates.html


Once I got over those few hurdles, I was able to get my app published and deployed. All and all it took less than 2 hours and was a great learning experience.


Have you published to the Serverless Application Repo? And if not, what’s stopping you?

Check out my app and let me know your thoughts!

dynamodb-to-s3-importer by Chris Plankey on AWS Serverless Application Repo

Thanks for reading!

Chris Plankey

Written by

Software Developer. AWS Enthusiast. Strong passion for voice technologies. https://chrisplankey.com/

More From Medium

More from Chris Plankey

More from Chris Plankey

Use Lambda Layers To Post To Slack

161

Related reads

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade