首页 > 解决方案 > 如何通过 CLI 停用 AWS 中的区域

问题描述

我正在尝试通过 CLI 停用帐户区域是否可以通过 CLI 进行?

我可以通过 AWS 控制台 IAM -> Account Settings -> Region -> Deactivate

标签: amazon-web-services

解决方案


根据AWS: Allows Enabling and Disabling AWS Regions - AWS Identity and Access Management,与启用账户相关的 IAM 权限前缀为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": ""
        }
    ]
}

找不到account类别的任何 AWS CLI 命令。(我在 boto3 中也没有看到任何东西。)

确实设法在以下位置找到了操作的参考:AWS 账户的操作、资源和条件键 - AWS 身份和访问管理。因此,它出现在各种开发工具包和 AWS CLI 中可能只是时间问题。

这个答案是在 2019 年 6 月写的,所以以后可能会发生变化。


推荐阅读