AWS Policy Examples

  create a policy that grants access to everything 

{

    "Version": "2020-09-20",

    "Statement": [

        {

            "Effect": “Allow”,

            "Action": “*”,

            "Resource": “*”

        }

    ]

}

create a policy that denies all EC2 permissions.

{

    "Version": "2020-09-20",

    "Statement": [

        {

            "Effect": “Deny”,

            "Action": “ec2:*”,

            "Resource": “*”

        }

    ]

}

create a policy that allows a user to ONLY stop and start EC2 instances.

{

    "Version": "2020-09-20",

    "Statement": [

        {

            "Effect": “Allow”,

            "Action": [

                “ec2:StartInstances:*”,

                “ec2:StopInstances:*”

            ],

            "Resource": “*”

        }

    ]

}

create a policy that allows a user to list the contents of S3 buckets with an ARN of arn:aws:s3:::myawesomebucket753512

{

    "Version": "2020-09-20",

    "Statement": [

        {

            "Effect": “Allow”,

            "Action": “s3:ListBucket"

            "Resource": [“arn:aws:s3:::myawesomebucket75351”]

        }

    ]

}

add write permissions to the policy you created above

{

    "Version": "2020-09-20",

    "Statement": [

        {

            "Effect": “Allow”,

            "Action": “s3:ListBucket"

            "Resource": [ “arn:aws:s3:::myawesomebucket75351”]

        },

       {

    “Effect” : “Allow”

    “Action” : [

                “s3:PutObject”,

“s3:GetObject”,

“s3:DeleteObject”

           ],

    “Resource” : [“arn:aws:s3:::myawesomebucket75351/*”]

       }

    ]

}

Comments

Popular posts from this blog

Effect : Deny vs No Action

AWS Summaries

Infrastructure Setup using Cloud Formation Templates