Switch branches/tags
Nothing to show
Find file History
Latest commit 6f33cfe Oct 16, 2018
Permalink
..
Failed to load latest commit information.
README.md cleanup formatting Sep 6, 2018
python.yaml fix macro typos Oct 16, 2018
python_example.yaml Use correct folder name for MacrosExamples Sep 6, 2018

README.md

PyPlate

Run arbitrary python code in your CloudFormation templates

Basic Usage

Place python code as a literal bock anywhere in your template, the literal block will be replaced with the contents of the output variable defined in your code. There are several variables available to your code:

params: dict containing the contents of the templateParameterValues template: dict containing the entire template account_id: AWS account ID region: AWS Region

AWSTemplateFormatVersion: "2010-09-09"
Description: tests String macro functions
Parameters:
  Tags:
    Default: "Env=Prod,Application=MyApp,BU=ModernisationTeam"
    Type: "CommaDelimitedList"
Resources:
  S3Bucket:
    Type: "AWS::S3::Bucket"
    Properties:
      Tags: |
        #!PyPlate
        output = []
        for tag in params['Tags']:
           key, value = tag.split('=')
           output.append({"Key": key, "Value": value})
Transform: [PyPlate]

Author

Jay McConnell
Partner Solutions Architect
Amazon Web Services