Is there a way to determine the Support plan usage level of the organization's sub-accounts?

0

Hello, we are a company that provides AWS managed services. We settle customers' expenses based on the CUR information of the organization's root account.

Under current AWS policy, the cost of most services is included in CUR information, but it is difficult to check the cost of support plans above the business level in CUR data.

We want to show our customers the estimated cost of their service plan next month when they are on a business level or higher support plan.

To do this, we need to know what level of support plan the customer is using. Is there a way to find out which support plan level an organization sub-account uses through the API provided by AWS?

질문됨 4달 전231회 조회
1개 답변
1

ATM There seems to be no CLi for checking support levels.

However, using a tip from this SO post https://stackoverflow.com/questions/54730858/can-the-aws-support-plan-be-changed-via-cli-api heres a Bash script you could run from the management account as long as you can assume a common role in each other account.

Requires jq, bash, cli and role in every sub account

#!/bin/bash
#User configurable variables
roletoassume="OrganizationAccountAccessRole"

accounts=$(aws organizations list-accounts --query "Accounts[*].Id")
account=$(aws organizations describe-organization |jq .Organization.MasterAccountId | tr -d '"')
masteraccount=$account


SUPPORT_STATUS=$(eval aws support describe-severity-levels --region us-east-1 2>&1)
    if [[ "$SUPPORT_STATUS" == *"SubscriptionRequiredException"* ]]; then
        echo $account,"No Support Enabled for account"
    elif [[ "$SUPPORT_STATUS" == *"AccessDeniedException"* ]]; then
        echo $account,"Access denied or roles not properly setup"
    elif [[ "$SUPPORT_STATUS" == *"critical"* ]]; then
        echo $account,"Enterprise Support already enabled for account..."
    elif [[ "$SUPPORT_STATUS" == *"urgent"* ]]; then
        echo $account,"Only Business Level Support enabled for account..."
    elif [[ "$SUPPORT_STATUS" == *"high"* ]]; then
        echo $account,"Only Developer Level Support enabled for account..."
    fi

echo $accounts | jq -c .[]| while read i;
do
        account=$(echo $i | tr -d '"')
        if [[ "$account" != "$masteraccount" ]]
        then
                sts=$(aws sts assume-role --role-arn arn:aws:iam::${account}:role/${roletoassume} --role-session-name mysession)
                var=( $(echo $sts | jq '.[] | .AccessKeyId, .SecretAccessKey, .SessionToken') )

                export AWS_ACCESS_KEY_ID=$(echo ${var[0]} | tr -d '"')
                export AWS_SECRET_ACCESS_KEY=$(echo ${var[1]} | tr -d '"')
                export AWS_SESSION_TOKEN=$(echo ${var[2]} | tr -d '"')

                SUPPORT_STATUS=$(eval aws support describe-severity-levels --region us-east-1 2>&1)
                if [[ "$SUPPORT_STATUS" == *"SubscriptionRequiredException"* ]]; then
                        echo $account,"No Support Enabled for account"
                elif [[ "$SUPPORT_STATUS" == *"AccessDeniedException"* ]]; then
                        echo $account,"Access denied or roles not properly setup"
                elif [[ "$SUPPORT_STATUS" == *"critical"* ]]; then
                        echo $account,"Enterprise Support already enabled for account..."
                elif [[ "$SUPPORT_STATUS" == *"urgent"* ]]; then
                        echo $account,"Only Business Level Support enabled for account..."
                elif [[ "$SUPPORT_STATUS" == *"high"* ]]; then
                        echo $account,"Only Developer Level Support enabled for account..."
                fi

                unset AWS_ACCESS_KEY_ID
                unset AWS_SECRET_ACCESS_KEY
                unset AWS_SESSION_TOKEN

        fi
done
profile picture
전문가
답변함 4달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠