Scroll Top

Best Use Cases for Serverless on AWS

Cron

Making Cron jobs automated with a serverless design takes away the burden of managing and paying for a server just to run a periodic cron job. A Lambda function can easily replace this small, but tedious action. AWS’s CloudWatch Events can be used to easily trigger Lambda functions to perform these cron jobs taking away the burden.

Web Applications

The most popular implementation of serverless design to web applications is with a single page application (SPA) for the frontend with static resources, such as, HTML, CSS, JavaScript, and image files hosted and deployed by Amplify that are loaded onto the user’s browser. Javascript executions are then sent and received via backend API that is built using Lambda and API Gateway. Cognito is used to provide user management and authentication to secure the backend APIs. DynamoDB provides the database where data can be stored by the APIs Lambda function.

For RESTful APIs, API Gateway offers immediate access to the following features:

  • Robust ways to control access
  • Request throttling down to each endpoint and method
  • Caching
  • Canary deployment for testing and production releases
  • Analytics

Besides the direct integration with DynamoDB and Elasticsearch, you can also use Lambda to integrate your AppSync API with other data sources such as Aurora.

Batch Processing

Another use case for serverless is to implement batch processing or fan-out. This is because of the fact that these systems tend to have spiky loads, and it’s difficult to maintain a balance between:

  • Quickly provisioning resources when a large batch of tasks occurs
  • Keeping infrastructure costs efficient especially when not using resources

SNS and Lambda are commonly used for batch processing. SNS is an asynchronous event source for Lambda, where every published message triggers a Lambda invocation. It allows the system to quickly achieve very high throughput (limited by regional concurrency limit) and the limit for scaling up that concurrency. Also, SNS has an automatic retry feature that when there is a Lambda invocation error and retries the failed invocation 2 more times.

With downstream systems, like a legacy database, that aren’t as scalable as SNS and Lambda controlling the number of concurrent Lambda executions is critical. Publishing too many messages can overwhelm the system if it is not set up to receive the spike. For these situations, Kinesis and SQS allow messages to be processed in batches and offer superior control over concurrency.

IoT

IoT Core allows IoT devices to connect with your backend services using MQTT, WebSockets, or HTTP. You can easily collect, process, and analyze data generated by your connected devices with services such as S3, Kinesis, Lambda, etc.

Serverless technologies like Lambda and IoT Core allow companies to focus on feature delivery instead of spending resources on infrastructure. The pay-per-use pricing model also allows companies to easily view operational costs linearly instead of potentially paying for resources that go unused.

Conclusion

Designing a serverless system on AWS requires a deep understanding of Lambda and how it is properly used with the other AWS services (DynamoDB, S3, Cognito, etc.) to create the most efficient, scalable, and cost-effective solution for your system. Let InCloud design the a great system for your needs with our expertise in designing, developing, and deploying serverless systems on AWS.

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.