- Newest
- Most votes
- Most comments
Strange behavior of CloudFormation, even without changing Lambda runtime (just taking the original file), if you click Template source - Upload a template file if shows the error:
Template format error
Follow the standard JSON or YAML spec to format your template.Learn more
Parser error
duplicated mapping key (143:3)
140 | - "TerminateCloudWa ...
141 | - "Arn"
142 | Id: "TerminateCloudWatc ...
143 | PermissionForEventsToInvokeLambda:
---------^
144 | Type: AWS::Lambda::Permission
145 | Properties:
but if you put the same template into Application Composer and validate it, it's completely fine and you can change Lambda runtime and successfully deploy the stack
also lines 111 and 143 have the same resource name PermissionForEventsToInvokeLambda, that's why parsing fails in the first case. Seems that Application composer ignores this.
You can rename one of PermissionForEventsToInvokeLambda to something else and Parsing error will be fixed
Maybe it was not a problem for CloudFormation in 2020 (when the mentioned blog post was written), but later AWS added some extra validation steps
Can you send your yaml and the error message?
answered 2 years ago
https://s3.amazonaws.com/public-customer-cloudwatch/create-cloudwatch-alarms.yaml
Please find this link
Relevant content
asked a year ago
asked 4 years ago
- AWS OFFICIALUpdated 2 years ago

Hi Oleksii,
Thank you for your input. I have already resolved the initial issue, but I am encountering a new problem. When testing the code in Lambda, I am receiving an error. Additionally, the CloudWatch agent is not being configured on my Windows and Linux servers. When I test manually from Lambda, it sets up CPU, memory, and disk alerts, but custom metric alerts show insufficient data due to the lack of an automated CloudWatch agent installation.
/var/task/lambda_cloudwatch_alarms.py:210: SyntaxWarning: invalid escape sequence '\P' "cd “C:\Program Files\Amazon\AmazonCloudWatchAgent\”", ".\amazon-cloudwatch-agent-ctl.ps1 -a fetch-config -m ec2 -c ssm:AmazonCloudWatch-windows", "" START RequestId: 9d1d00c3-e7b2-41b7-80cc-c1cb1b24be4c Version: $LATEST installing and configuring Cloudwatch agents on the instance : windows ========== Instances to install Cloudwatch Agents: i-0702a0a********** ============RunCommand sent successfully Creating Alarms for instance :windows END RequestId: 9d1d00c3-e7b2-41b7-80cc-c1cb1b24be4c REPORT RequestId: 9d1d00c3-e7b2-41b7-80cc-c1cb1b24be4c Duration: 1268.07 ms Billed Duration: 1269 ms Memory Size: 1024 MB Max Memory Used: 98 MB Init Duration: 550.49 ms