skip to Main Content

Can AWS Serverless Application Model (SAM) add new functions to an existing API Gateway resource imported via Fn::ImportValue function into the current stack?

2

Answers


  1. Currently, it is not possible. To expose Lambda Functions via API Gateway in SAM, the API Gateway must be created in the same SAM template.
    You can use the CloudFormation Import Function to reference a resource attribute or output from another stack but you can not add methods.

    That is a limitation of SAM and there are more details about that in this discussion but without expectations on a near solution date.

    Login or Signup to reply.
  2. Yes, you can add new functions to API Gateway Apis created in other stacks if your API Gateway were created using AWS::ApiGateway::RestApi.

    You’ll need to import the ApiGateway Id and RootResourceId attributes to your SAM template and create the ApiGatewayMethod for each integration and a deployment for your Api.

    Reference:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search