- Newest
- Most votes
- Most comments
The following is a sample, but I thought it could be used by simply setting the return value from "AWS::ApiGateway::RestApi" in "ParentId".
Also, try putting the name of the Lambda function in the "PathPart" field.
https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html#cfn-apigateway-resource-parentid
Api:
Type: "AWS::ApiGateway::RestApi"
Properties:
Name: "api_cfn_test"
Resource:
Type: "AWS::ApiGateway::Resource"
Properties:
RestApiId: !Ref Api
ParentId: !GetAtt Api.RootResourceId
PathPart: !Sub "${FunctionName}"
DependsOn:
- Api
Hi,
I'm assuming that you are using the Serverless Application Model (SAM). The resource EventSoure does not define a field ParentId for the type Api.
The CloudFormation resource AWS::ApiGateway::Resource does however.
If you are using SAM, the EventSource resource will automatically link your AWS Lambda function to the respective API Gateway method.
Thank You, But i have a seprate Stack(Nested Stack) for my Api Gateway and Lambda i have already defined my reource eg[user/ member] i want the lambda even to point to the resource /user
Relevant content
- asked 6 months ago
- asked 9 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Thank You, But i have a seprate Stack(Nested Stack) for my Api Gateway and Lambda i have already defined my reource eg[user/ member] i want the lambda even to point to the resource /user
I have made some modifications to CloudFormation that I have used in the past. In CloudFormation, set the URL in "AWS::ApiGateway::Resource".