I am creating a custom policy (studying for a certification) and was trying to create a comment within the JSON code block.
Any assistance would be appreciated. Thank you!
This is what I attempted after doing research, as there is very little regarding the ERROR AWS threw regarding the comments.
1. This is the code block to be used as an example from AWS:
-------------------------------------------------------------
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "support:*",
"Resource": "*"
},
{
"Effect": "Deny",
"Action": "support:ResolveCase",
"Resource": "*"
}]
}
2. This is the modified code with JSON comments (which threw the ERROR):
------------------------------------------------------------------------
{
"__comment1__": "Custom policy to specify what actions to allow or deny.",
"__comment2__": "The following policy statement allows an IAM user to perform",
"__comment3__": "all actions in AWS Support except resolve a case.",
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "support:*",
"Resource": "*"
},
{
"Effect": "Deny",
"Action": "support:ResolveCase",
"Resource": "*"
}]
}
The ERROR AWS threw is as follows:
Ln 2, Col 20Invalid Policy Element: The policy element __comment1__ is not valid.
What I have tried:
I have tried to add in comments, per the article from FreeCodeCamp but that is when AWS threw the ERROR.
JSON Comment Example — How to Comment in JSON Files[
^]