-
-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support maximum concurrency of Lambda with SQS as an event source #402
Changes from all commits
91e4b8e
13e655a
4247b3c
748c6c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,20 @@ provider "aws" { | |
region = "eu-west-1" | ||
|
||
# Make it faster by skipping something | ||
skip_get_ec2_platforms = true | ||
|
||
skip_metadata_api_check = true | ||
skip_region_validation = true | ||
skip_credentials_validation = true | ||
skip_requesting_account_id = true | ||
} | ||
|
||
data "aws_availability_zones" "available" {} | ||
|
||
locals { | ||
vpc_cidr = "10.0.0.0/16" | ||
azs = slice(data.aws_availability_zones.available.names, 0, 3) | ||
} | ||
|
||
#################################################### | ||
# Lambda Function with event source mapping | ||
#################################################### | ||
|
@@ -20,12 +27,15 @@ module "lambda_function" { | |
handler = "index.lambda_handler" | ||
runtime = "python3.8" | ||
|
||
source_path = "${path.module}/../fixtures/python3.8-app1" | ||
source_path = "${path.module}/../fixtures/python3.8-app1/index.py" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was throwing an error around a specific version of python being required. Changing to point directly to the individual file fixed that. I don't believe that affects the intent of this example |
||
|
||
event_source_mapping = { | ||
sqs = { | ||
event_source_arn = aws_sqs_queue.this.arn | ||
function_response_types = ["ReportBatchItemFailures"] | ||
scaling_config = { | ||
maximum_concurrency = 20 | ||
} | ||
} | ||
dynamodb = { | ||
event_source_arn = aws_dynamodb_table.this.stream_arn | ||
|
@@ -216,21 +226,26 @@ resource "aws_kinesis_stream" "this" { | |
} | ||
|
||
# Amazon MQ | ||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
module "vpc" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have any default VPCs, so added a bare bones one to make it work for the RabbitMQ requirements |
||
source = "terraform-aws-modules/vpc/aws" | ||
version = "~> 3.0" | ||
|
||
name = random_pet.this.id | ||
cidr = local.vpc_cidr | ||
|
||
azs = local.azs | ||
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)] | ||
|
||
data "aws_security_group" "default" { | ||
vpc_id = data.aws_vpc.default.id | ||
name = "default" | ||
enable_nat_gateway = false | ||
} | ||
|
||
resource "aws_mq_broker" "this" { | ||
broker_name = random_pet.this.id | ||
engine_type = "RabbitMQ" | ||
engine_version = "3.8.11" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is almost at EOS so updated to latest recommended by AWS |
||
engine_version = "3.10.10" | ||
host_instance_type = "mq.t3.micro" | ||
security_groups = [data.aws_security_group.default.id] | ||
security_groups = [module.vpc.default_security_group_id] | ||
subnet_ids = slice(module.vpc.public_subnets, 0, 1) | ||
|
||
user { | ||
username = random_pet.this.id | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed due to