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.
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
- Canary deployment for testing and production releases
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.
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 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.
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.