Skip to content

non-existing-organization/terraform-module-aws-lambda-api-cloudwatch

Repository files navigation

Contributors Forks Stargazers Issues GPL3 License LinkedIn Ask Me Anything


master Logo

terraform-module-aws-lambda-api-cloudwatch

Easy Deploy Lambda, API and Cloudwatch
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

AWS draw.io image

The main purpose of this terraform module is to deploy an easy Lambda function with API trigger and Cloudwatch logging for both Lambda and API Getway.

Built With

  • Terraform
  • AWS
    • Lambda
    • Cloudwatch
    • API Gateway

Getting Started

Prerequisites

  • None

Installation

module "example" {
  source               = "git::https://github.com/stiliajohny/terraform-module-aws-lambda-api-cloudwatch.git?ref=master"
  lambda_app_name      = "example_name"
  lambda_filename      = "example_code.py"
  api_gw_route_key     = "$default"
  lambda_handler       = "my_code_method.lambda_handler"
}

Usage

Terraform-docs Output

Requirements

No requirements.

Providers

Name Version
archive 2.2.0
aws 3.70.0

Modules

No modules.

Resources

Name Type
aws_apigatewayv2_api.my-slack_event_handler resource
aws_apigatewayv2_integration.my-slack_event_handler resource
aws_apigatewayv2_route.my-slack_event_handler resource
aws_apigatewayv2_stage.my-slack_event_handler resource
aws_cloudwatch_log_group.my-slack_event_handler_api_gw resource
aws_cloudwatch_log_group.my-slack_event_handler_lambda resource
aws_iam_role_policy_attachment.lambda_policy resource
aws_lambda_function.my-slack_event_handler resource
aws_lambda_permission.my-slack_event_handler resource
archive_file.zip data source
aws_iam_role.iam_for_lambda data source

Inputs

Name Description Type Default Required
api_gw_integration_methode The integration methode for the API Gateway. string "POST" no
api_gw_integration_type The integration type for the API Gateway. string "AWS_PROXY" no
api_gw_protocol_type The protocol type for the API Gateway. string "HTTP" no
api_gw_route_key The route key for the route. For HTTP APIs, the route key can be either $default, or a combination of an HTTP method and resource path, for example, GET /pets. string "$default" no
aws_region The AWS region to create things in. string "us-east-1" no
cloudwatch_log_retention_days The number of days to retain logs in CloudWatch. number 14 no
lambda_app_description The description of the Lambda function. string "A simple Lambda function that says hello." no
lambda_app_name The name of the Lambda function. string n/a yes
lambda_architecture The architecture of the lambda function list(any)
[
"x86_64"
]
no
lambda_env_variables The environment variables to pass to the Lambda function. map(string)
{
"variable_name": "variable_value"
}
no
lambda_filename The name of the Lambda function's file. string n/a yes
lambda_handler The name of the Lambda function's handler. string n/a yes
lambda_memory_size The amount of memory to allocate to the lambda function number 128 no
lambda_runtime The runtime to use for the Lambda function. string "python3.9" no
tags (Optional) A mapping of tags to assign to the bucket. map(any) {} no

Outputs

Name Description
api_base_url Base URL for API Gateway stage.
iam_for_lamda The name of the savings_plan_utilization budget
lambda_function_name Name of the Lambda function.

Costs

You can use the tool infracost to see an estimate how much the deployment of resources might cost depending on the usage.

The tool can be installed via this doc

After that you can issue the command:

infracost.exe breakdown --path . --show-skipped

Roadmap

See the open issues for a list of proposed features (and known issues).


Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GPLv3 License. See LICENSE for more information.

Contact

John Stilia - stilia.johny@gmail.com


Acknowledgements