Search code examples
amazon-web-servicesaws-cloudformationaws-samaws-sam-cliserverless-application-model

How to transform a Serverless Application Model (SAM) template to Cloudformation?


From this answer I understand that SAM is a transform of Cloudformation.

Is there a way to get the transformed Cloudformation template from a SAM template via the console, CLI, or another way?


Solution

  • For SAM projects already deployed, you should find the native CloudFormation template, post transformation, in the CloudFormation console. Select your stack, then open the Template tab. You can also retrieve this via the awscli using aws cloudformation get-template.

    You can also use the SAM cli, for example:

    sam package \
      --output-template-file output.yaml \
      --s3-bucket mybucketname