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

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ