Skip to content

maximivanov/deploy-aws-lambda-to-vpc-with-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy AWS Lambda to VPC with Terraform

Code for Deploy AWS Lambda to VPC with Terraform

Usage:

docker run --rm -it -v $(pwd):/var/app -w /var/app --entrypoint bash amazon/aws-cli
aws configure
yum install -y yum-utils
Loaded plugins: ovl, priorities
amzn2-core                                                                                                                                                                                                                                                                                             | 3.7 kB  00:00:00
Resolving Dependencies
...
yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
Loaded plugins: ovl, priorities
adding repo from: https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
grabbing file https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo to /etc/yum.repos.d/hashicorp.repo
repo saved to /etc/yum.repos.d/hashicorp.repo
yum -y install terraform
Loaded plugins: ovl, priorities
hashicorp                                                                                                                                                                                                                                                                                              | 1.4 kB  00:00:00
hashicorp/2/x86_64/primary                                                                                                                                                                                                                                                                             |  39 kB  00:00:00
hashicorp                                                                                                                                                                                                                                                                                                             255/255
Resolving Dependencies
...
cd terraform

terraform init
terraform apply

Invoke Lambda:

aws lambda invoke --function-name lambda-vpc-tf-lambda-function out.txt
{
    "StatusCode": 200,
    "ExecutedVersion": "$LATEST"
}
cat out.txt
"If you spell Chuck Norris in Scrabble, you win. Forever."

About

Terraform module with all the cloud resources needed to run Lambda within a VPC

Topics

Resources

License

Stars

Watchers

Forks

Contributors