apigtw-sqs-integration

All Contributors

This project is a basic sample of API gateway integration with a SQS queue and a lambda consumer.

Architecture

Below is an architectural drawing with resource communications.

architecture

Requirements

  • Terraform v0.13.5
  • Your aws credentials configured
  • A s3 bucket for your tf.state file

Applying your resources

First, make sure you have your credentials file configured with your AWS account in your local machine.

[default]
aws_access_key_id = YOUR-ACCESS-KEY-ID
aws_secret_access_key = YOU-SECRET-ACCESS-KEY

Create a bucket in s3 and change your main.tf with your bucket name.

terraform {
  backend "s3" {
    bucket = "my-bucket-name"
    key    = "tf-state/terraform.tfstate"
    region = "us-east-1"
  }
}

Initialize Terraform.

$ terraform init

Make a plan in the project root directory. (optional)

$ terraform plan

Run apply to create all the resources.

$ terraform apply

After applying, the output shows the API gateway endpoints resources.

Outputs:

apigateway_resource_one = https://id.execute-api.us-east-1.amazonaws.com/dev/one
apigateway_resource_two = https://id.execute-api.us-east-1.amazonaws.com/dev/two

Invoking API

To invoke your api gateway and test your infrastructure, import the collection and environment from the docs folder and set your api gateway id generated from apply.

Destroy

To destroy all your infrastructure, just run terraform destroy.

$ terraform destroy

Documentations

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Leonardo Menezes
Leonardo Menezes

💻

This project follows the all-contributors specification. Contributions of any kind welcome!