Subtubes
Subtubes

Reputation: 16873

How to deactivate region in AWS through the CLI

I am trying to deactivate an accounts regions via the CLI is it possible to do through the CLI?

I can do it via the AWS console IAM -> Account Settings -> Region -> Deactivate

Upvotes: 1

Views: 1545

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269500

According to AWS: Allows Enabling and Disabling AWS Regions - AWS Identity and Access Management, the IAM permissions related to enabling accounts is prefixed by account::

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "EnableDisableHongKong",
            "Effect": "Allow",
            "Action": [
                "account:EnableRegion",
                "account:DisableRegion"
            ],
            "Resource": "",
            "Condition": {
                "StringEquals": {"account:TargetRegion": "ap-east-1"}
            }
        },
        {
            "Sid": "ViewConsole",
            "Effect": "Allow",
            "Action": [
                "aws-portal:ViewAccount",
                "account:ListRegions"
            ],
            "Resource": ""
        }
    ]
}

I could not find any AWS CLI commands for the account category. (Nor did I see any in boto3.)

I did manage to find a reference of the actions at: Actions, Resources, and Condition Keys for AWS Accounts - AWS Identity and Access Management. So, it might just be a matter of time until it appears in the various SDKs and the AWS CLI.

This answer was written in June 2019, so things might have changed later.

Upvotes: 1

Related Questions