0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWS 支払い設定用IAMユーザーの作成について

0
Posted at

概要

購買部門が支払い情報を入力する際に、一時的にIAMユーザーを作成して koubai グループに所属させる手順です。代替連絡先の"請求に関する連絡先"にもアクセスしたいということなので、インラインポリシーで権限を追加しました。
作業完了後は一時的に作成したIAMユーザーを削除します。

構成図

手順

1. グループの作成(初回のみ)

aws iam create-group --group-name koubai --region ap-northeast-1

2. ポリシーのアタッチ(初回のみ)

AWS管理ポリシー Billing をアタッチ:

aws iam attach-group-policy \
  --group-name koubai \
  --policy-arn arn:aws:iam::aws:policy/job-function/Billing \
  --region ap-northeast-1

代替連絡先用のインラインポリシーをアタッチ:

aws iam put-group-policy \
  --group-name koubai \
  --policy-name BillingAlternateContactAccess \
  --policy-document '{
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": [
          "account:GetAlternateContact",
          "account:PutAlternateContact",
          "account:DeleteAlternateContact"
        ],
        "Resource": "*"
      }
    ]
  }' \
  --region ap-northeast-1

注意: マネジメントコンソールの代替連絡先ページは BILLING / OPERATIONS / SECURITY を同時に取得するため、
特定タイプのみに Condition で制限するとページ全体がエラーになります。

3. 一時ユーザーの作成(必要時)

# ユーザー作成
aws iam create-user --user-name koubai --region ap-northeast-1

# グループに追加
aws iam add-user-to-group --user-name koubai --group-name koubai --region ap-northeast-1

# コンソールログイン用パスワード設定
aws iam create-login-profile \
  --user-name koubai \
  --password '<初期パスワード>' \
  --password-reset-required \
  --region ap-northeast-1

4. 作業完了後のユーザー削除

# ログインプロファイル削除
aws iam delete-login-profile --user-name koubai --region ap-northeast-1

# グループから削除
aws iam remove-user-from-group --user-name koubai --group-name koubai --region ap-northeast-1

# ユーザー削除
aws iam delete-user --user-name koubai --region ap-northeast-1

付与されるポリシー詳細

AWS管理ポリシー: Billing(v27)

カテゴリ 主なアクション
請求ポータル aws-portal:*Billing, *Usage, *PaymentMethods
Billing billing:Get*, billing:Create*, billing:Update*
Budgets budgets:ViewBudget, budgets:ModifyBudget
Cost Explorer ce:GetCostAndUsage, ce:CreateReport
コスト・使用状況レポート cur:DescribeReportDefinitions, cur:PutReportDefinition
支払い payments:GetPaymentInstrument, payments:MakePayment
請求書 invoicing:GetInvoicePDF, invoicing:ListInvoiceSummaries
税務 tax:GetTaxRegistration, tax:PutTaxRegistration
発注書 purchase-orders:*

インラインポリシー: BillingAlternateContactAccess

アクション 説明
account:GetAlternateContact 代替連絡先の参照
account:PutAlternateContact 代替連絡先の登録・更新
account:DeleteAlternateContact 代替連絡先の削除

マネジメントコンソールの代替連絡先ページは BILLING / OPERATIONS / SECURITY を同時に取得するため、
Condition で特定タイプのみに制限するとページ全体がエラーになる。そのため全タイプを許可している。

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?