Skip to content

Packaging

cfnrain adds features to the CloudFormation template language. CloudFormation does not know these features, so cfnrain turns them into a plain template before it sends the template to AWS. This step is packaging.

Packaging processes:

Files that packaging uploads go to the artifact bucket.

Which commands package

These commands package the template before they use it: pkg, deploy, forecast, stackset deploy and cc deploy.

cfnrain pkg packages a template and prints the result. Use it to see what CloudFormation gets:

cfnrain pkg app.yaml -o app.packaged.yaml

Run linters such as cfn-lint on the packaged template, because they do not know the cfnrain features.

Paths

A path in a template is relative to the directory of the template file that contains it. It is not relative to the directory where you run cfnrain. In an included file or a module, paths are relative to that file.

Templates can run code

Two features run programs from your computer:

  • Run in !Rain::S3 runs a script when cfnrain packages the template.
  • RunBefore and RunAfter in S3 bucket metadata run commands when cfnrain deploys the template.

Run works without --experimental. Only package and deploy templates that you trust.