Is it possible to create with Cloud Formation a child resource for an API Gateway resource created with AWS SAM?

1

I have an API Gateway defined with AWS SAM, it's resources and methods are defined implicitly by AWS::Serverless::Function (Events property).

The current API has the following path: /api/resource-A/{detail}/

I want to create a new method of lambda Non proxy integration type for the /detail/ path (which is a nested resource), but it requires to be defined with Cloud Formation using AWS::ApiGateway::Method as I need to use some apache-velocity-templates for data mapping.

Is it possible to define it as a method of the /{detail}/ resource created by SAM? Since there is a property called ResourceId that is not possible to retrieve from the generated resources of SAM for API events

Additional information: StackOverflow questionhttps://stackoverflow.com/questions/74647318/how-to-set-the-resourceid-in-awsapigatewaymethod-if-was-implicitly-created-b

1 回答
0

SAM is just a transform so you can look at your template in the deployed Stack in the CF console, and switch on "View processed template". Any resources you're creating should be visible in there and their logical IDs can be referenced in your template code.

专家
已回答 1 年前
  • Well, what I can see is that the only resources created by SAM when defining the API resources and methods in the event source of the Lambda function, are the REST API, the deployment, and the stage, the lambda function itself and some permissions, but there are no AWS::ApiGateway::Resource or AWS::ApiGateway::Method.

    Then I don't know if to access them all must be redefined using cloud formation

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则