👮‍♂️

個人のAWSアカウントでAWS Orgnizationsのポリシーを設定する。

2023/03/29に公開

はじめに

AWS Orgnizations のポリシーを設定する。
以下 2 つを設定した。

  1. AWS の AI 系のサービスに情報を与えないように設定する。
  2. Sandbox 用の AWS アカウントは東京でしかリソースを作成できないようにする。

AWS Orgnizations のポリシー

AWS Orgnizations のポリシーを開く。以下が表示される。

上から順番に設定する。

AI サービスのオプトアウトポリシー

AWS Orgnizations の SCP を使って、AWS の AI サービスに情報を提供しないように出来る。
以下の設定を参考に設定する。

https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out_syntax.html?icmpid=docs_orgs_console

全てを拒否したいので以下を設定した。これをルートにアタッチした。

  • 名前: OptOutOfAllAIServices
  • 説明: Opt out of all AI services for all accounts in the organization
{
  "services": {
    "@@operators_allowed_for_child_policies": ["@@none"],
    "default": {
      "@@operators_allowed_for_child_policies": ["@@none"],
      "opt_out_policy": {
        "@@operators_allowed_for_child_policies": ["@@none"],
        "@@assign": "optOut"
      }
    }
  }
}

バックアップポリシー

こちらは Orgnizations 全体でバックアップを強制出来る設定。お金がかかりそうなので設定しない。

サービスコントロールポリシー

これは Orgnizations の機能を絞れる。
以下を参考に Sandbox や Dev アカウントで東京以外のリージョンを使えないように設定する。

https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_general.html

これを Sandbox の OU にアタッチした。

  • 名前: DenyAllOutsideTokyo
  • 説明: Deny access to AWS based on the requested AWS Region
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyAllOutsideTokyo",
      "Effect": "Deny",
      "NotAction": [
        "a4b:*",
        "acm:*",
        "aws-marketplace-management:*",
        "aws-marketplace:*",
        "aws-portal:*",
        "budgets:*",
        "ce:*",
        "chime:*",
        "cloudfront:*",
        "config:*",
        "cur:*",
        "directconnect:*",
        "ec2:DescribeRegions",
        "ec2:DescribeTransitGateways",
        "ec2:DescribeVpnGateways",
        "fms:*",
        "globalaccelerator:*",
        "health:*",
        "iam:*",
        "importexport:*",
        "kms:*",
        "mobileanalytics:*",
        "networkmanager:*",
        "organizations:*",
        "pricing:*",
        "route53:*",
        "route53domains:*",
        "route53-recovery-cluster:*",
        "route53-recovery-control-config:*",
        "route53-recovery-readiness:*",
        "s3:GetAccountPublic*",
        "s3:ListAllMyBuckets",
        "s3:ListMultiRegionAccessPoints",
        "s3:PutAccountPublic*",
        "shield:*",
        "sts:*",
        "support:*",
        "trustedadvisor:*",
        "waf-regional:*",
        "waf:*",
        "wafv2:*",
        "wellarchitected:*"
      ],
      "Resource": "*",
      "Condition": {
        "StringNotEquals": {
          "aws:RequestedRegion": ["ap-northeast-1"]
        }
      }
    }
  ]
}

タグポリシー

こちらは Orgnizations 全体でタグを強制出来る設定。タグ設計について勉強してから設定する。

おわりに

AWS Orgnizations のポリシーを設定した。タグ設計は勉強して設定したい。

Discussion