How insisive cloud uses AWS Lambda

Posted By:Shivaranjani Ramakrishnan
Posted on:29 Aug 2019

AWS Lambda has so many use-cases. We’re an early-stage cloud cost optimization startup and we’ve found AWS Lambda to be so useful in terms of scaling and ease of use when compared to putting our code on an EC2 server. Lambda scales effortlessly and integrates easily with other aws services and makes the case for building amazing loosely coupled and high cohesion microservices.

They are extremely cheap as they follow the ‘pay as you use’ model. From our experience, most of our functions run pretty quickly and we’ve never really been too affected by Cold Starts as we use lambda functions for sending mass emails and as cron jobs.

Lambda functions as Cron Jobs 

A cron is a Linux utility that schedules a command or script on your server to run automatically at a specified time and date. A cron job is the scheduled task itself. Cron jobs can be very useful to automate repetitive tasks. 

insisive cloud we provide advanced data-driven automation to help companies reduce their cloud spend drastically. Many of our automation tasks run on Lambda. 

How do you configure cron jobs?

aws lambda cron jobs insisive cloud

AWS CloudWatch collects monitoring and operational data in the form of logs, metrics, and events, providing you with a unified view of AWS resources, applications, and services. CloudWatch logs are where you find all your lambda function logs. To use CloudWatch to configure cron jobs you have to basically follow these steps :

1. Assuming you already have your lambda function that needs to be triggered at fixed periods of time in place, go to the CloudWatch service. Once you’re here click on Create rule under Events.

cwevent insisive cloud


2. Choose a Fixed rate of and specify how often the task is to run, or choose Cron expression and specify a cron expression that defines when the task is to be triggered and enter your cron expression.

3. For Targets, you can go ahead and choose Lambda function, on doing so all the functions in that specific region show up. You can choose your required function that needs to be triggered and then click on configure the rule.

insisive cloud uses aws lambda

4. You can also add event data as part of the rule for your lambda functions and can have multiple functions as targets.

If you want your Lambda to be triggered not on a daily basis but rather on a different scale, such as minutes, hours and days you can choose the ‘Fixed rate of’ radio button under the Schedule option.

Sending mass emails using Lambda and SES

insisive Cloud send insightful weekly and daily emails to all our clients showing them where they can cut costs, and how their current AWS ecosystem is in terms of cost and security. This requires us to send a lot of emails and we use SES along with AWS Lambda for this. Amazon Simple Email Service (Amazon SES) is a cloud-based email sending service designed to help digital marketers and application developers send marketing, notification, and transactional emails. It is a reliable, cost-effective service for businesses of all sizes that use email to keep in contact with their customers. 

It is quite easy to setup SES for use by your Lambda function.

  • Verify your email with the SES service before using it to send emails, unverified emails will result in an ‘Access Denied’ error.
  • Once you have verified your email, you can use your language-specific SDK API for sending emails using SES.
  • In Python’s Boto3 you would use the following API call :
response = client.send_email(



        'ToAddresses': [



        'CcAddresses': [



        'BccAddresses': [





        'Subject': {

            'Data': 'string',

            'Charset': 'string'


        'Body': {

            'Text': {

                'Data': 'string',

                'Charset': 'string'


            'Html': {

                'Data': 'string',

                'Charset': 'string'












            'Name': 'string',

            'Value': 'string'





  • After you put this code snippet along with your other logic your lambda function needs to have IAM permissions to use the SES service, and hence your lambda role attached to the function should have permissions for the same.
  • After this is set up, you can choose to trigger your lambda whenever the need be.

Monitoring Environments & Limits

For whatever reason it may be if your staging or production environment were to go down you should be notified immediately. Or when a service goes past an expected threshold due to some circumstances you need to be notified rather than receive a huge bill at the end of the month. In this case, you can configure a CloudWatch for the specific event change and then add an SNS topic as a target for the Event. Amazon Simple Notification Service (SNS) is a highly available, durable, secure, fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and serverless applications. The created SNS topic can have a lambda function as a subscriber that can perform remedial actions as required, like sending notifications to slack, etc. 

Make the most of your cloud and start saving upto by 60% with insisive cloud. Schedule a demo or drop us an email at Start saving now!

Leave a Reply

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

Notice: Undefined index: loggedin_user in /var/www/html/wp-content/plugins/freshchat/widget-settings/add_to_page.php on line 97