This lab walks you through the steps to deploy Lambda functions using Cloudformation
You will practice using an Amazon Cloudformation stack and AWS Lambda function trigger.
Duration: 1 Hour
AWS Region: US East (N. Virginia) us-east-1
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.
If there are any errors during the execution of the template, the cloudformation template will roll back and delete the resources provisioned.
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.
Launching Lab Environment
Navigate to the S3 Bucket
Download S3 Bucket Stack Template
Editing the s3_bucket.json Template
Download EC2 Stack Template
Editing the ec2_instance.json Template
Creating the S3 Stack and Testing the Lambda function
Creating the EC2 Stack and Testing the Lambda function