AWS Terraform Lambda Provisioned Concurrency

Question:

I’m trying to get provisioned concurrency to work with my API gateway backed Lambda function.

Following config does not work, AWS seems to completely ignore provisioned concurrency and will cold-start.

figuring it might’ve something to do with the version not being specified I tried adding config following the accepted answer here: Terraform – what is the URI to invoke lambda via alias?

but now I’m getting an error that states This object has no argument, nested block, or exported attribute named "user_history_version"

Does anyone know how I can get my provisioned concurrency working?

Answer:

You’re on the right track – if you use the unqualified lambda arn, you reference the version at $LATEST, while your provisioned concurrency uses the latest published version.

You can fix your problem by either referencing the alias ARN (aws_lambda_alias. user_history_alias.arn), or, if you don’t need the alias for something else, referencing aws_lambda_function.user_history.qualified_arn, which will be the latest published version.

Leave a Reply