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 Respuesta
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.

EXPERTO
respondido hace un año
  • 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

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas