Traverse the Lambda Function URL Feature Using CloudFormation
Tags: cloudformation, lambda, iamrole, aws
Published: 2023-04-30 18:34:07

“ I have checked the documents of AWS to traverse the lambda function url feature using cloudformation. I have checked the feature of the lambda function to enable the function url using cloudformation. The Pricing is based on scenario usage for lambda and cloudwatch log group.”

AWS CloudFormation is a service that helps you model and set up your AWS resources so that you can speed less time managing those resources and more time focusing on your applications that run in AWS. You create a template that describes all the AWS resources that you want (like Amazon EC2 instances or Amazon RDS DB instances), and CloudFormation takes care of provisioning and configuring those resources for you.

Lambda is a compute service that lets you run code without provisioning or managing servers. Lambda runs your code on a high-availability compute infrastructure and performs all of the administration of the compute resources, including server and operating system maintenance, capacity provisioning and automatic scaling, code monitoring and logging. With Lambda, you can run code for virtually any type of application or backend service.

In this post, you will experience “traverse the lambda function url feature using cloudformation”. Here I have created a lambda function and the function url using cloudformation with required permission.

#Architecture Overview
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0zfa8xxayreqy8h5elz1.png)
The architecture diagram shows the overall deployment architecture with data flow, iam role, cloud formation, lambda.

#Solution overview
The blog post consists of the following phases:
1. Create of IAM Role and Stack for Lambda Function URL
2. Testing of Lambda Function URL

##Phase 1: Create of IAM Role and Stack for Lambda Function URL
1. Open the IAM Console and create a role for lambda service with AWS lambda basic execute policy. Create a cloudformation stack for lambda function with lambda function URL. Also add permission on lambda function for function URL.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5f2d9harvxhd97boahkd.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1djqq3ukzcuczen7bht.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fl6mugwzamo9otj89ypp.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n6qrp87almq6uid4seuq.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cdf3z1bemsnb5rijz6s7.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q41elrbun12jup2ea7ec.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ugxr1v6qbjz7baaecij9.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/veimvkedokwhd72ka5ae.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ktghu09usy32dwehu6vr.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xg0i6myop4f6p6wj53jj.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zd4jy33yuspltb66vpbf.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mnfpi04crsz553fzrer.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dorrxpxxo4qc7ky4dn37.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4f34d1b1j6l9r2elsg0.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzv87wzod5wqjuzxcbte.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5q7sqzdpx439dct7f4w.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkqnm043bfbmiywdvec5.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvdm6ql9qldhdm6p4tii.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sklwix6ehsz10e4lups7.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zvro63c9ggrdkef2gv6j.png)

##Phase 2: Testing of Lambda Function URL

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fm5x2eaf8ec7aeamfci1.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2tiauh1w6j8n5hkdb9q3.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zeqceuugb9q1yfoxjmlf.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivgygibah06yj7ef18pj.png)

#Clean-up
Delete IAM Role, CloudFormation and CloudWatch Log Group.

#Pricing
I review the pricing and estimated cost of this example. 

Cost of Cloudwatch = $0.0

Cost of Lambda = $0.0

Total Cost = $0.0

#Summary
In this post, I showed “how to traverse the lambda function url feature using cloudformation”.

For more details on AWS CloudFormation, Checkout Get started AWS CloudFormation, open the [AWS CloudFormation console](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/). To learn more, read the [AWS CloudFormation documentation](https://docs.aws.amazon.com/cloudformation/?id=docs_gateway).

For more details on AWS Lambda, Checkout Get started AWS Lambda, open the [AWS Lambda console](https://ap-south-1.console.aws.amazon.com/lambda/home?region=ap-south-1#/discover). To learn more, read the [AWS Lambda documentation](https://docs.aws.amazon.com/lambda/?id=docs_gateway).

Thanks for reading!

Connect with me: [Linkedin](https://www.linkedin.com/in/gargee-bhatnagar-6b7223114)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38sdi4nsp89fnui8h7dk.png)