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.

전문가
답변함 일 년 전
  • 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

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠