Submitting a Serverless Application to AWS Serverless Repository in 5 easy steps

Submitting a Serverless application to AWS Serverless Repository can be a tedious task since there isn’t a lot of documentation available. There aren’t any review processes in the submission process and only the SAM (Serverless Application Model) template is validated. Furthermore, SAM template verification is strictly enforced by validating the syntax; i.e. cloud formation template might not be directly compatible.

Submitting an Application to AWS Serverless Repository

Step 1

The first step is generating the CloudFormation template required to deploy the Serverless application. You could start off by directly creating a SAM template. If you choose this option, you can skip Step 1, Step 2 and Step 3.  However, there’s a powerful UI tool, Sigma, which can be used to generate the CloudFormation template. If you’ve already created your project using Sigma hit on the deploy button. Afterwards, In the browser console, the CloudFormation template will be generated.

aws serverless repository - AWS CloudFormation Template Generation
AWS CloudFormation Template Generation

Right click on the variable and hit save as global variable.  Then, you could easily copy the variable using the copy command.

aws serverless repository - AWS CFT Store as global Variable
AWS CFT Store as global Variable
aws serverless repository - AWS CFT copy using command
AWS CFT copy using command

Step 2

Since the generated CloudFormation template is in JSON format, you will need to convert it into YAML format.  Thanks to cfn_flip this is an easy task. If you have python already installed just hit enter.

pip install cfn_flipcfn_flip examples/test.json cloudformation.yaml

This will generate the cloudformation.yaml required to deploy the project.

Step 3

Unfortunately, you will have to transform your template into the SAM format. For example, AWS::Lambda::function and policies should be converted into AWS::Serverless::Function form.

The following links will guide you to convert it into a SAM template.

  1. Creating Serverless resources – https://docs.aws.amazon.com/lambda/latest/dg/serverless_app.html
  2. How to create Serverless applications using AWS SAM – https://github.com/awslabs/serverless-application-model/blob/master/HOWTO.md
  3. Policy template examples – https://github.com/awslabs/serverless-application-model/blob/master/examples/2016-10-31/policy_templates/all_policy_templates.yaml

At the end of this step, you will have a SAM template that can be deployed.

Step 4

Next, you will need to create a zip file containing your lambda functions and required libraries. If you’re using nodejs for example,  you will need to add your source files and the node_modules folder to a zip file.

aws serverless repository - Folder View
Folder View

Upload this zip file to an S3 bucket and make the zip file publicly available.  Furthermore, you will have to include this URI name in the CodeUri  tag within the SAM template. This sample CloudFormation file demonstrates how it should be included.

Step 5

Upload the CloudFormation template, README.md, and the License using the following dialog.

aws serverless repository - Publish an AWS  Serverlesss application
Publish an AWS  Serverlesss application

Click Publish Application on the website.

If there aren’t any verification problems the app will be published instantly.

If you’d like to learn more about serverless architectures, this blog post might be useful. 😉

Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *