Bootstrap FreeKB - Amazon Web Services (AWS) - Create Policy using the AWS CLI
Amazon Web Services (AWS) - Create Policy using the AWS CLI


This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

Let's create a JSON file named policy.json that contains the policy JSON, perhaps something like this.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "cloudwatch:GetMetricData"
            ],
            "Resource": "*"
        }
    ]
}

 

Then the aws iam create-policy command can be used to create a policy.

aws iam create-policy --policy-name my-cloudwatch-getmetricsdata --policy-document file://getmetricsdata.json

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 0e502d in the box below so that we can be sure you are a human.