DEV Community

Cover image for Prut Salad Season [CD]
Jasten!
Jasten!

Posted on

Prut Salad Season [CD]

bRo reviewed and wrote a JSON guide (kinda)

Merry Quismois! I like writing.

Reread IAM Section;

Rando JSON sample with comments and messy indentation. Literally my notes bro.

{
  "Version": "2012-10-17", 
  "_comment1": "Comments slow down parsing, Date shows current version of the language. ",
  "Id": "EC2_Account_Permissions", 

  "_comment2": "Id? Identification opkors. This is optional",

  "Statement": [
    {
      "_comment3": "Literally, 'Statement ID'",
      "Sid": "First_Permission_Here", 
      "_comment4": "Effect shows what can be denied and what can be accessed. The principal is the user to which the policy is applied.",
      "Effect": "Allow", 
      "Principal": [ "arn:was:iam:345564325124:root"] 
    }, 
    "_comment5": "Action can be seen in AWS documentation.(Service Authorization Reference. Again: ARN == Acquirer Reference Number)",
    "_comment6": "Action is the list of actions this policy allows or denies. A resource is the list of resources to which the actions are applied.",
    "_comment7": "You can build the resource part: arn:aws:ec2:<REGION>:<ACCOUNT_ID>:instance/<instance-id>",

    "Action": [ 
      "ec2:AcceptAddressTransfer",
      "ec2:AcceptReservedInstancesExchangedQuote", 
      "ec2:AcceptTransitGatewayMulticastDomainAssociations"
    ],
    "Resource": ["arn:was:ec2:ap-southeast-1:345564325124:instance/:i-0123456789abcdef0"]

}
]
}

Enter fullscreen mode Exit fullscreen mode

No comments and fixed(?) indentation:

{
  "Version": "2012-10-17",
  "Id": "EC2_Account_Permissions",
  "Statement": [
    {
      "Sid": "First_Permission_Here",
      "Effect": "Allow",
      "Principal": ["arn:was:iam:345564325124:root"],
      "Action": [
        "ec2:AcceptAddressTransfer",
        "ec2:AcceptReservedInstancesExchangedQuote",
        "ec2:AcceptTransitGatewayMulticastDomainAssociations"
      ],
      "Resource": ["arn:was:ec2:ap-southeast-1:345564325124:instance/:i-0123456789abcdef0"]
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)