Creating a Macros

https://github.com/awslabs/aws-cloudformation-templates/tree/master/aws/services/CloudFormation/MacrosExamples/Count

aws cloudformation package \
    --template-file template.yml \
    --s3-bucket cf-macro-iterate \
    --output-template-file packaged.yaml

export AWS_PROFILE=<profile>

aws cloudformation deploy \
  --template-file packaged.yaml \
  --stack-name Iterate \
}

Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression “Status” we matched expected path: “FAILED” Status: FAILED. Reason: Requires capabilities : [CAPABILITY_IAM]

export AWS_PROFILE=wilmer
aws cloudformation deploy \
  --template-file packaged.yaml \
  --stack-name Iterate \
  --capabilities CAPABILITY_IAM
}

No transform named 225491667295::Count found.

but the stack that was using the macros was in

Now it works

make sure that s3 bucket does’nt have more than 1 object in there. delete the older ones if so

Macros for one snippet, not entire template

this is wrong and what I was originally using

https://github.com/aws/aws-cli/issues/5619

Please disregard. The example code in the aws-cloudformation macro sample repository is in error. Upon closer inspection the string_example.yaml defines the ‘Fn::Transform’ as a list containing a single object with Name and Parameter fields. This is invalid and inconsistent with the documentation which clearly states to have a single object defining Fn::Transform not a list of object. I will submit a PR to the aws-cloudformation repository.

https://docs.amazonaws.cn/en_us/AWSCloudFormation/latest/UserGuide/template-macros.html

this is correct

When I was passing domains like this

I was getting this

now it works

this is from the lambda logs

in lamda index.js, i need to add a period to the end of the domain

Leave a Reply

Your email address will not be published.