Going Serverless: Tools and Tips

AWS Serverless Application Repository
Share This Post

AWS Serverless Application Repository In the first article of this three-part series, we discussed the why and the how so many organizations are building powerful, cost-efficient, compliant architecture while removing OS complexities using serverless architecture. We talked basics — what it really means to be serverless, AWS Lambda and limitations you should be aware of. In this Part 2, we delve into the AWS Serverless Application Repository, discuss how you can deploy existing applications and what to consider when creating your own apps.

AWS Serverless Application Repository: Developers Don’t Let Developers Build from Scratch

At Werner Vogel’s keynote in re:Invent 2017, AWS announced that they would be launching an exciting new service that allows customers to easily discover and deploy applications within the AWS cloud. They called it the AWS Serverless Application Repository, essentially a collection of publicly shared AWS Lambda applications published by developers and companies that are working in the serverless ecosystem, that can be deployed quickly to your AWS account. The Serverless Application Repository contains code samples for logging and monitoring services, data processing, mobile backends, and more. It also provides a link to the source code and an explanation of how the application works. There is no additional charge to use the Serverless Application Repository—you only pay for the AWS resources the deployed application uses. With the Serverless Application Repository, you don’t need to know the language in which the code is written, as each application is completely self-contained and runs in its own environment. While deploying third-party applications requires reading the documentation and instructions, you can deploy the Serverless Application Repository by simply clicking the deploy button and entering the requested parameters. In addition, you don’t have to worry about infrastructure compatibility since Lambda functions run on AWS.

AWS Serverless Application Model (AWS SAM)

Serverless applications contained in the Serverless Application Repository are defined using the AWS Serverless Application Model (AWS SAM), which extends the AWS CloudFormation template to simplify the applications’ resource definitions. These serverless applications consist of AWS SAM templates and code stored in S3 buckets. These specs can currently define APIs, Lambda functions, and Amazon DynamoDB tables. You can also use SAM Translator which translates SAM templates into AWS Cloudformation stacks. The good news– AWS SAM is now open-source! AWS SAM comes under an Apache 2 license so it’s very easy to get involved and improve these tools using the AWS open source community at Github.

Creating Your Own Applications

The AWS Serverless Application Repository can also be used to publish your own applications in order to share your solutions with other developers. Anyone with an AWS account can publish a piece of code using the Serverless Application Repository. When creating an application, keep the following suggestions in mind:

Simplify Your Applications

Keep your applications well defined, meaning the fewer the resources per application, the better. You can then save time by combining multiple applications that were built in smaller pieces, and bringing those together to build more complex solutions. Trying to keep your applications small and well-defined, with only a few resources is much more efficient than creating a bigger app. For example, you can create a Lambda application that processes images stored in an S3 bucket and outputs them to another bucket. If you need a more complex option, consider combining multiple applications into one streamlined application.

Sharing Your Applications

With the AWS Serverless Application Repository, your applications can be either public or private. For example, if you want to share your application just within your organization or within your development team, you can do so in private — both within your AWS account and with other AWS accounts. Private applications are a secure way to share various internal resources.

Use Parameters

Because resources for applications are deployed as an AWS CloudFormation stack, you can use parameters for custom value input when creating that stack. These parameters allow you to define various configurations for your deployment, such as which S3 bucket to write files into or which Amazon Simple Queue Service (SQS) queue to poll from. Parameters are part of AWS Cloudformation as well as AWS SAM. Parameters allow you to input custom values each time you create or update a stack. It’s a simple way to allow your applications to be put into someone else’s AWS account without having to hardcode any information. Be sure to consider security like API keys (AWS key management service comes in very useful here).

Outputs & Cross-stack references

Not only can you provide information as input parameters, but you can also output information which is key when doing cross-stack references. Outputs are also important since you can declare values used for various purposes like importing into other stacks or cross-stack referencing. You can view the outputs in the AWS CloudFormation console. Cross-stack references allow you to create separate stack instead of including all resources in one single stack. This will let you refer to outputs from other stacks. This will save you time, as it eliminates hardcoding information into a SAM template. You can simply use information from the original template and put into that stack.

Necessary Backup for Serverless

Getting your serverless applications up and running, and saving time using best practices is only half the story. It’s essential to not only run and scale your applications easily but to make sure those applications are protected from downtime due to human errors, bugs, outages, natural disasters, malware, ransomware or other inevitable malicious breaches. It is essential that your backup and recovery process be tested, your RTO reach its internal goal, and you can recover your data instantaneously once downtime hits. Cloud Protection Manager from N2WS allows you to auto-magically backup your serverless applications as often as you like and recover them in the same region, a different region or even into another AWS account in case your production account has been breached.  You can start testing today using our 30-day free trial (configure and start backing up in <14 minutes with no credit card). We’re also happy to provide a demo.

Final Note on Serverless

The AWS Serverless Application Repository allows you to find pieces of code that others have written and to use them with your AWS account. It also enables you to share your original applications with others. It is versatile and easy to use, making it an invaluable tool for many organizations. There are also many other valuable tips and tricks to help you save time when building serverless applications, like focusing on small applications or microservices, setting up the right parameters and saving time using cross-stack references. In the final article of this series, we will discuss AWS Lambda@Edge, which can help run your code across global AWS locations when an Amazon CloudFront event occurs. We will also preview Amazon Aurora Serverless, a new offering pushing serverless into the realm of databases, which was recently announced at AWS re:Invent 2018.

Subscribe To Our Newsletter
Get updates and learn from the best
More To Explore

Activate a free trial of N2WS —and get $100​

Try N2WS Backup & Recovery today —and we'll give you $100 in AWS credits.