Support Documents

Deploying Lambda Functions using CloudFormation

Lab Details

  1. This lab walks you through the steps to deploy Lambda functions using Cloudformation

  2. You will practice using an Amazon Cloudformation stack and AWS Lambda function trigger.

  3. Duration: 1 Hour

  4. AWS Region: US East (N. Virginia) us-east-1


Amazon CloudFormation

  • A complex application which requires multiple AWS resources can be managed by a single service called AWS CloudFormation. Sometimes, managing the multiple AWS resources you need can be more time consuming than the time spent on developing the applications.

  • AWS Cloudformation enables us to design the infrastructure and setup AWS resources which can be managed with less manual intervention in an orderly and predictable manner

  • CloudFormation is a tool which is used to design and implement your applications quickly.

  • CloudFormation consists of templates that can be written in JSON or YAML.

  • Templates can be created using AWS Cloudformation designer.

  • Templates can also created manually.

  • Templates created can be reused to replicate the design in multiple environments.

  • Resources provisioned by a template are called a Stack.

  • A Stack is an updatable set of resources which can be modified at any point in time.

  • CloudFormation will automatically configure and provision resources based on the template and will automatically take care of any dependency handling between the resources.

  • AWS Cloudformation enables us to manage infrastructure through a text file.

   Amazon Lambda

  • AWS Lambda is a Serverless Compute service.

  • It works without any servers and allows us to execute code for any type of application.

  • The developer doesn't have to worry about the AWS resources to launch or the steps needed to manage the resources.

  • The configuration of the tasks are done as code . They are implemented in Lambda and performed on execution.

  • Provisioning and Managing are both taken care of by the Lambda function.

  • The languages AWS Lambda supports are Node.js, Python, C#, Java and Go.

  • It allows us to run code in response to events from other AWS services.

  • Automatic Scaling is done based on the size of the workload.

  • The Lambda Code is executed from Triggers which are received from AWS resources.

  • The cost of AWS Lambda is very low and depends on multiple factors. It will charge for every 100ms of runtime also for the number of times the code is executed.

  • The allowable runtimes a Lambda function execution is between 100ms to 5 Mins.

  • It offers resources varying from 128MB of memory to 3GB of memory. 

 Architecture Diagram

Task Details

  1. Launching Lab Environment

  2. Navigate to the S3 Bucket

  3. Download S3 Bucket Stack Template

  4. Editing the s3_bucket.json Template

  5. Download EC2 Stack Template

  6. Editing the ec2_instance.json Template

  7. Creating the S3 Stack and Testing the Lambda function

  8. Creating the EC2 Stack and Testing the Lambda function

  9. Validation of the lab.

Launching Lab Environment

     1. To launch the lab environment, Click on the  button.

     2. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.

     3. Once the Lab is started, you will be provided with IAM user namePasswordAccess Key, and Secret Access Key. 

Note : You can only start one lab at any given time.