AWS GovCloud での Identity Access Manager の設定
CloudFormation テンプレート (CFT) を使用して管理アカウントの 3 つの AWS アカウントタイプに対して AWS CloudFormation Identity Access Manager (IAM) リソースを作成し、クラウドアカウント管理 (CAM) を AWS GovCloud とServiceNow統合します。
始める前に
ターゲットユーザーアカウントに必要な AWS IAM 権限があることを確認します。詳細については、「Amazon Web サービス API 権限について」を参照してください。
注:
IAM 権限を実装するときは、常に組織のセキュリティポリシーに従ってください。
必要なロール:AWS admin
このタスクについて
AWS GovCloud アカウントは常に商用アカウントにリンクされているため、IAM リソースは次の 3 つの AWS アカウントタイプにわたって作成する必要があります。
- AWS 商用管理アカウント:GovCloud にリンクする標準 AWS アカウント。
- AWS GovCloud ルート管理アカウント:GovCloud 環境のメインアカウント。
- AWS GovCloud 組織管理アカウント:GovCloud 環境で組織リソースを管理するためのアカウント。
手順
-
各 CloudFormation テンプレート (CFT) コードを
.yml拡張子の別のファイルにコピーし、ファイルを保存します。 - ルートユーザー認証情報を使用して AWS 管理コンソールにログインします。
-
手順に従って、各スクリプトを順番に実行します。
-
AWS 商用管理アカウント CFT スクリプト
- 商用 AWS コンソールにログインします。
- 検索バーに「 CloudFormation 」と入力して選択し、CloudFormation コンソールにアクセスします。
- CloudFormation コンソールで、 スタックを作成 > 既存のテンプレートを選択 > テンプレートファイルのアップロード > ファイルを選択してください をクリックして、ローカルコンピューターからテンプレートファイルを選択します。
スタックは、単一のユニットとして管理できる AWS リソースのコレクションです。
- 保存された商用 CFT スクリプトを使用して、
SNUserNameパラメーターを設定します。 - 出力パラメーター
SNUserARNとSNUserを記録します。
AWSTemplateFormatVersion: '2010-09-09' Description: This script creates a ServiceNow user in the AWS Commercial Management Account for Cloud Account Management (CAM) integration. Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: User Credentials Parameters: - SNUserName ParameterLabels: SNUserName: default: User Name in the AWS Commercial environment Parameters: SNUserName: Type: String Description: User name for ServiceNow Cloud Workspace application in AWS Commercial Environment MinLength: '6' MaxLength: '15' ConstraintDescription: The username must be between 6 and 15 characters Resources: # AWS Commercial Resources SnowCWMemberAccountAccessGroup: Type: 'AWS::IAM::Group' Properties: GroupName: SnowCWMemberAccountAccessGroup Description: IAM Group for ServiceNow Cloud Workspace users with permissions to manage AWS Organizations SnowCWAccountAccessPolicy: Type: 'AWS::IAM::Policy' Properties: PolicyName: SnowCWAccountAccessPolicy PolicyDocument: Version: '2012-10-17' Statement: # Create Account Workflow Permissions - Sid: ServiceNowCreateAccountAccess Effect: Allow Action: - 'budgets:CreateBudgetAction' - 'budgets:DescribeBudgetAction' - 'organizations:CreateGovCloudAccount' - 'organizations:DescribeCreateAccountStatus' - 'organizations:MoveAccount' - 'organizations:TagResource' - 'organizations:ListRoots' Resource: '*' # Account Management Workflow Permissions - Sid: ServiceNowAccountManagementAccess Effect: Allow Action: - 'budgets:ListTagsForResource' - 'budgets:ModifyBudget' - 'budgets:ViewBudget' - 'iam:GetAccountPasswordPolicy' - 'iam:GetAccountSummary' - 'iam:GetRole' - 'iam:ListAccountAliases' - 'organizations:AttachPolicy' - 'organizations:DescribePolicy' - 'organizations:DetachPolicy' - 'sts:AssumeRole' Resource: '*' # Discovery Workflow Permissions - Sid: ServiceNowDiscoveryAccess Effect: Allow Action: - 'organizations:DescribeAccount' - 'organizations:DescribeOrganization' - 'organizations:DescribeOrganizationalUnit' - 'organizations:ListAccounts' - 'organizations:ListAWSServiceAccessForOrganization' - 'organizations:ListOrganizationalUnitsForParent' - 'organizations:ListParents' - 'organizations:ListRoots' - 'organizations:ListTagsForResource' Resource: '*' Groups: - !Ref SnowCWMemberAccountAccessGroup Description: Policy that grants permissions required for ServiceNow CAM in the AWS Commercial environment CreateServicenowUser: Type: 'AWS::IAM::User' Properties: Path: / UserName: !Ref SNUserName Tags: - Key: Purpose Value: ServiceNowCAMIntegration Description: IAM user for ServiceNow CAM integration with AWS Commercial environment AddSnowUserToSnowCWMemberAccountAccessGroup: Type: 'AWS::IAM::UserToGroupAddition' Properties: GroupName: SnowCWMemberAccountAccessGroup Users: - !Ref SNUserName DependsOn: CreateServicenowUser Description: Adds the ServiceNow user to the access group Outputs: SNUserARN: Description: ARN of ServiceNow user in AWS Commercial environment Value: !GetAtt CreateServicenowUser.Arn SNUser: Description: Username of the created ServiceNow user in AWS Commercial environment Value: !Ref SNUserName -
AWS GovCloud ルート管理アカウント CFT スクリプト
- GovCloud AWS コンソールにログインします。
- 検索バーに「 CloudFormation 」と入力して選択し、CloudFormation コンソールにアクセスします。
- CloudFormation コンソールで、 スタックを作成 > 既存のテンプレートを選択 > テンプレートファイルのアップロード > ファイルを選択してください をクリックして、ローカルコンピューターからテンプレートファイルを選択します。
- 保存済みの GovCloud ルート CFT スクリプトを使用して、
SNGovUserNameパラメーターを設定します。 - 出力パラメーター
SNGovUserARNとSNGovUserを記録します。
注:わかりやすくするために、このテンプレートでは SnowCWGovCloudUserPolicy のリソース ARN にワイルドカード (*) を使用し、 ServiceNow ユーザーが任意の GovCloud アカウントでロールを引き受けることができるようにします。これは機能的には機能しますが、必要以上に多くの権限が付与されます。
本番環境の場合:- 組織アカウント ID のパラメーターを追加します。
OrgAccountId: タイプ:文字列 - [リソース] フィールドを更新します。
Resource: !Sub 'arn:aws-us-gov:iam::${OrgAccountId}:role/ServiceNowGovCrossAccountRole' - 複数のアカウントを操作する方法については、「CloudFormation パラメーター」および「CommaDelimitedList の使用」を参照してください
- IAM ポリシーの保護に関する詳細なガイダンスについては 、「AWS IAM のベストプラクティス」 を参照してください
AWSTemplateFormatVersion: '2010-09-09' Description: This script creates a ServiceNow user in the AWS GovCloud Management Account for Cloud Account Management (CAM) integration. Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: User Credentials Parameters: - SNGovUserName ParameterLabels: SNGovUserName: default: AWS User Name in the GovCloud environment Parameters: SNGovUserName: Type: String Description: User name for ServiceNow Cloud Workspace application in AWS GovCloud Environment MinLength: '6' MaxLength: '15' ConstraintDescription: The username must be between 6 and 15 characters Resources: # AWS GovCloud Resources SnowCWGovCloudAccessGroup: Type: 'AWS::IAM::Group' Properties: GroupName: SnowCWGovCloudAccessGroup Description: IAM Group for ServiceNow Cloud Workspace users in AWS GovCloud environment CreateGovCloudServicenowUser: Type: 'AWS::IAM::User' Properties: Path: / UserName: !Ref SNGovUserName Tags: - Key: Purpose Value: ServiceNowCAMIntegration Description: IAM user for ServiceNow CAM integration with AWS GovCloud environment SnowCWGovCloudUserPolicy: Type: 'AWS::IAM::Policy' Properties: PolicyName: SnowCWGovCloudUserPolicy PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: 'sts:AssumeRole' Resource: 'arn:aws-us-gov:iam::*:role/ServiceNowGovCrossAccountRole' - Effect: Allow Action: 'sts:AssumeRole' Resource: 'arn:aws-us-gov:iam::*:role/OrganizationAccountAccessRole' Groups: - !Ref SnowCWGovCloudAccessGroup Description: Policy that grants basic permissions and ability to assume the cross-account role AddSnowUserToSnowCWGovCloudAccessGroup: Type: 'AWS::IAM::UserToGroupAddition' Properties: GroupName: SnowCWGovCloudAccessGroup Users: - !Ref SNGovUserName DependsOn: - CreateGovCloudServicenowUser - SnowCWGovCloudAccessGroup Description: Adds the ServiceNow GovCloud user to the access group Outputs: SNGovUserARN: Description: ARN of ServiceNow user in AWS GovCloud environment Value: !GetAtt CreateGovCloudServicenowUser.Arn SNGovUser: Description: Username of the created ServiceNow user in AWS GovCloud environment Value: !Ref SNGovUserName -
AWS GovCloud 組織管理アカウント CFT スクリプト
- GovCloud 組織 AWS コンソールにログインします。
- CloudFormation コンソールにアクセスするには、検索バーに「 CloudFormation 」と入力して選択します。
- CloudFormation コンソールで、 スタックを作成 > 既存のテンプレートを選択 > テンプレートファイルのアップロード > ファイルを選択してください をクリックして、ローカルコンピューターからテンプレートファイルを選択します。
- 保存された GovCloud 組織 CFT スクリプトを使用し、
SNGovUserARNパラメーターを AWS GovCloud ルート管理アカウント CFT スクリプトから記録された出力に設定します。 - 出力パラメーター
RoleARNを記録します。
AWSTemplateFormatVersion: '2010-09-09' Description: This template creates the ServiceNowGovCrossAccountRole in the AWS Organization Management Account for ServiceNow CAM integration. Metadata: AWS::CloudFormation::Interface: ParameterGroups: - Label: default: Role Configuration Parameters: - SNGovUserARN ParameterLabels: SNGovUserARN: default: ServiceNow GovCloud User ARN Parameters: SNGovUserARN: Type: String Description: ARN of the ServiceNow GovCloud user that will assume this role AllowedPattern: '^arn:aws(-[a-z0-9-]+)?:iam::[0-9]{12}:user/.*$' ConstraintDescription: Must be a valid AWS IAM user ARN Resources: ServiceNowGovCrossAccountRole: Type: 'AWS::IAM::Role' Properties: RoleName: ServiceNowGovCrossAccountRole Description: Role used by ServiceNow CAM for cross-account operations in AWS GovCloud AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: AWS: !Ref SNGovUserARN Action: 'sts:AssumeRole' Policies: - PolicyName: ServiceNowGovCloudPolicy PolicyDocument: Version: '2012-10-17' Statement: # Create Account Workflow Permissions - Sid: ServiceNowGovCreateAccountAccess Effect: Allow Action: - 'organizations:InviteAccountToOrganization' - 'organizations:ListRoots' - 'organizations:MoveAccount' - 'organizations:TagResource' Resource: '*' # Account Management Workflow Permissions - Sid: ServiceNowGovAccountManagementAccess Effect: Allow Action: - 'iam:GetAccountAuthorizationDetails' - 'iam:GetAccountPasswordPolicy' - 'iam:GetAccountSummary' - 'iam:GetRole' - 'iam:ListAccountAliases' - 'organizations:AttachPolicy' - 'organizations:DescribePolicy' - 'organizations:DetachPolicy' Resource: '*' # Discovery Workflow Permissions - Sid: ServiceNowGovDiscoveryAccess Effect: Allow Action: - 'ec2:DescribeRegions' - 'organizations:DescribeAccount' - 'organizations:DescribeOrganization' - 'organizations:DescribeOrganizationalUnit' - 'organizations:ListAccounts' - 'organizations:ListAWSServiceAccessForOrganization' - 'organizations:ListOrganizationalUnitsForParent' - 'organizations:ListParents' - 'organizations:ListRoots' - 'organizations:ListTagsForResource' Resource: '*' Outputs: RoleARN: Description: ARN of the ServiceNowGovCrossAccountRole Value: !GetAtt ServiceNowGovCrossAccountRole.Arn
-
AWS 商用管理アカウント CFT スクリプト
- [ 次へ ] を選択して続行し、テンプレートを検証します。
- [ スタックの詳細を指定 (Specify stack details )] ページで、[ スタック名 ] フィールドにテンプレートの名前を入力します。
スタック名:
- 大文字と小文字を区別する英数字とハイフンのみを使用できます
- 英字で始まる必要があります
- 128 文字以内にする必要があります
- [ユーザー名] フィールドに、クラウドアカウント管理サービスアカウントのユーザー名を入力します。
- [次へ] を選択します。
- [ スタックオプションの設定 ] ページで、[ AWS CloudFormation がカスタム名で IAM リソースを作成する可能性があることを承認します ] チェックボックスをオンにして、[ 次へ] を選択します。
-
[ 確認して作成 ] ページで、[ 送信 ] を選択してスタックを起動します。
IAM アカウントが作成されます。
-
作成した 2 人のユーザーのセキュリティ認証情報を追加するには:
- [リソース] を選択します。
- ユーザー名のリンクを選択します。
- [アクセス キー] セクションで、[ アクセス キーの作成] を選択します。
-
[Access key best practices & alternatives] ページで、[Third-party service] オプションを選択します。
このアクセスキーを使用して、 AWS リソースを監視または管理するサードパーティアプリケーションまたはサービスへのアクセスを有効にすることができます。
- [上記の推奨事項を理解し、アクセス キーの作成に進みます] チェック ボックスをオンにして、[次へ] を選択します。
- [アクセスキーを作成 (Create access key)] を選択します。
-
[ アクセス キーの確認 ] ページで、アクセス キー ファイルをダウンロードし、 [完了] を選択します。
注:アクセスキーと秘密キーを Terraform アドミンおよび ServiceNow AI Platform アドミンと共有します。