LoginSignup
3
0

More than 3 years have passed since last update.

[制限撤廃済]AWSのSupportは各操作へ個々のアクセス可否を独立して設定できない→できるようになりました

Last updated at Posted at 2019-06-17

追記

2019/11/18にこの制限は撤廃された。 アカウント宛に案内メールがきており、検証したら制限撤廃されていた。ドキュメント反映待ち。ドキュメントに反映してほしいとのフィードバックは送った。

2020/04/20時点でドキュメントにも反映されていること(制限の記載がなくなっていること)を確認しました。
https://docs.aws.amazon.com/ja_jp/awssupport/latest/user/getting-started.html#accessing-support

概要( 現在は撤廃されている )

IAMポリシーでは、各操作毎にAllow/Denyを設定できるが、Supportに関しては個別に設定できない。

Support全体という単位でしかAllow/Denyできない。

ので注意がいる。。。

公式ドキュメント

サポートでは、個々の操作へのアクセス権を許可または拒否することはできません。そのため、ポリシーの Action 要素は常に support:* に設定されます。

どういうこと?

support操作のAllowDenyを書くとき

"Action": "support:DescribeTrustedAdvisorChecks",

とか

"Action": "support:Describe*",

といった記載は、意味をなさない。

"Action": "support:*",

という書き方のみ有効。

検証

LambdaからTrustedAdvisor(以降、TA)のDescribeTrustedAdvisorChecksを呼び出し、TAが対応しているチェック項目を取得します。

Lambda

lambda_function.py

import json
import boto3

def lambda_handler(event, context):
    support = boto3.client("support", region_name="us-east-1")
    res = support.describe_trusted_advisor_checks(language="ja")
    print(f"checks len = {len(res['checks'])}")
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
    }

IAM policy

成功するパターン

正常にTAのチェック項目を取得できるパターン。

support:* をAllow

policy.json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "condition0",
            "Effect": "Allow",
            "Action": "support:*",
            "Resource": "*"
        }
    ]
}

support:* をAllow + support:Describe*をDeny

policy.json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "condition0",
            "Effect": "Allow",
            "Action": "support:*",
            "Resource": "*"
        },
        {
            "Sid": "condition1",
            "Effect": "Deny",
            "Action": "support:Describe*",
            "Resource": "*"
        }
    ]
}

Denyに書いている "Action": "support:Describe*", が無効なので、Describeできてしまう。

失敗するパターン

support:DescribeTrustedAdvisorChecks をAllow

policy.json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "condition0",
            "Effect": "Allow",
            "Action": "support:DescribeTrustedAdvisorChecks",
            "Resource": "*"
        }
    ]
}

support:Describe* をAllow

policy.json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "condition0",
            "Effect": "Allow",
            "Action": "support:Describe*",
            "Resource": "*"
        }
    ]
}

上記はいずれも、以下のようなエラーが出て失敗します。

error.log
An error occurred (AccessDeniedException) when calling the DescribeTrustedAdvisorChecks operation: User: arn:aws:sts::nnnnnnnnn:assumed-role/rolename/lambdaname is not authorized to perform: support:

備考

IAM Policy Simulator

IAM Policy Simulator上では、この制限はシミュレートされてなさそうです。

"Action": "support:DescribeTrustedAdvisorChecks"をAllowしているポリシーに対し
IAM Policy Simulatorで「AWS SupportDescribeTrustedAdvisorChecks」を「Run Simulation」したところallowedになりました。
ただ実際に動かすと前述の通り失敗します。

困った

ユーザーやロールに「サポートケース系は隠してTAだけアクセスさせる」というのをしたかったが、できない。
フィードバックはあげたので、個別設定できるようになればいいな。。。

参考

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0