/lambda-template

This repository will be a template for create lambdas

Primary LanguagePython

lambda-template

CREATE AWS LAMBDA (GOLANG, PYTHON) USING TERRAFORM

Requirements

  1. AWS Cli installed and login to AWS account
  2. Terraform installed

How ?

  1. Go to scripts folder
  2. Create bucket using this command, Please type unique name for bucket
./1_create_s3_bucket.sh
  1. Build, zip, and upload code to S3 using this command. You can take a look code inside lambda-go folder. Script will ask you to type version, just type e.g. "1.0.0"
./2_build_zip_upload.sh
  1. Create lambda and api gateway using this command. Script will ask you type for version, pleaset type version you create in step number 2 "1.0.0"
./3_terraform_apply_auto_version.sh
  1. Access your code in terraform output, base_url

Updating Code

  1. Go to scripts folder
  2. Update main.go inside lambda-go folder line 17 "Hello" to "Hello Ludes"
message := fmt.Sprintf(" { \"Message\" : \"Hello %s \" } ", name)
  1. Build, zip, and upload code to S3 using this command. You can take a look code inside lambda-go folder. Script will ask you to type version, you can change your version with another tag e.g. "1.0.1"
./2_build_zip_upload.sh
  1. Create lambda and api gateway using this command. Script will ask you type for version, pleaset type version you create in step number 2 "1.0.1"
./3_terraform_apply_auto_version.sh
  1. Access your code in terraform output, base_url

Delete Everything

  1. Go to scripts folder
  2. To delete s3 type command below
./delete_s3_bucket.sh
  1. To delete lambda + api gateway type command below
./terraform_destroy_auto_version.sh