Reputation:
I am creating infrastructure with terraform with API Gateway connecting to DynamoDb API. I am creating resource
aws_api_gateway_integration
to define the integration with DynamoDb with type
attribute set as AWS
.
But somehow i am unable to get the uri
value right for db.
Documentation says it should be of format arn:aws:apigateway:{region}:{subdomain.service|service}:{path|action}/{service_api}
.
Current value configured is arn:aws:apigateway:us-east-1:dynamodb:GetItem
.
I am not sure what is service_api
. Did anyone encounter this before? Kindly help.
Upvotes: 9
Views: 3791
Reputation: 1138
This also took me some time to figure out, I think the DynamoDB API-Gateway Integration deserves a dedicated example in the Terraform docs similar to Lambda. Actually service_api
just refers to the DynamoDB Action (which you would also enter in the AWS Api Gateway Console Action
field) prefixed with the literal action/
. So the following block eventually worked for my PUT request mapping:
resource "aws_api_gateway_integration" "my-integration" {
type = "AWS"
integration_http_method = "POST"
uri = "arn:aws:apigateway:eu-central-1:dynamodb:action/PutItem"
# (...)
}
Upvotes: 17