This Terraform code sets up an AWS Lambda function with an API Gateway. The Lambda function returns a simple message when invoked via the API Gateway. The code also creates an IAM role for the Lambda function, attaches necessary policies, and sets up a default stage for the API Gateway.
- An AWS account with sufficient permissions to create Lambda functions and API Gateways
- Terraform installed on your local machine
- Clone the repository to your local machine:
git clone https://github.com/mterrano1/Boilerplate---terraform-lambda-api-gateway-zip.git
- Navigate to the terraform-lambda-api-boilerplate directory:
cd terraform-lambda-api-boilerplate
- Initialize the Terraform configuration:
terraform init
-
Review the configuration files in the
main.tf
andlambda_function.py
files. -
Deploy the infrastructure to AWS:
terraform apply
-
Wait for the deployment to complete. When it's finished, Terraform will output the URL of the API Gateway.
-
Test the API Gateway by visiting the URL in a web browser or using a tool such as
curl
. -
When you're finished, tear down the infrastructure:
terraform destroy
If you find a bug or have a feature request, please open an issue or submit a pull request.