AI サービスのオプトアウトポリシーを OU に適用してみた
こんにちは!クラウド事業本部コンサルティング部のたかくに(@takakuni_)です。
皆さんは AWS のサービス規約を、ご覧になったことはありますでしょうか?
いくつかの AWS で提供される AI サービスには、サービス向上のために AWS 側で収集したデータを利用できる権利を有するものがあります。該当するリソースは、サービス規約からご覧ください。(たとえば、Amazon Q Developer の無料利用枠 [1] などが挙げられます。)
ただし、利用者側は上記の権利を Organizations の AI サービスのオプトアウトポリシー、 利用する IDE のオプトアウト設定、該当するサービスごとに用意されているオプトアウトメカニズム等を利用することで、オプトアウトできます。
50.3. You agree and instruct that for Amazon CodeGuru Profiler, Amazon Comprehend, Amazon Lex, Amazon Polly, Amazon Rekognition, Amazon Textract, Amazon Transcribe, and Amazon Translate: (a) we may use and store AI Content that is processed by each of the foregoing AI Services to develop and improve the applicable AI Service and its underlying technologies; (b) we may use and store AI Content that is not personal data to develop and improve AWS and affiliate machine-learning and artificial-intelligence technologies; and (c) solely in connection with the development and improvement described in clauses (a) and (b), we may store such AI Content in an AWS region outside of the AWS region where you are using such AI Service. This Section does not apply to Amazon Comprehend Medical, Amazon Transcribe Medical, AWS HealthScribe, Amazon Comprehend Detect PII or any AI Service that is not listed in the first sentence of this Section 50.3. You may instruct AWS not to use and store AI Content processed by an AI Service to develop and improve that Service or technologies of AWS or its affiliates by configuring an AI services opt-out policy using AWS Organizations. For access to AI Services via AWS Builder ID, you may instruct AWS to refrain from using and storing AI Content processed by an AI Service to develop and improve that Service or technologies of AWS or its affiliates by using the opt-out mechanism indicated in the applicable service documentation.
50.13. Amazon Q. To help Amazon Q provide the most relevant information, we may use AI Content processed by Amazon Q, such as prompts and responses (“Amazon Q Content”), for service improvement as described below. Currently, this Section 50.13 applies only to Amazon Q Developer Free Tier, but we may add Amazon Q features from time to time as they launch. This Section 50.13 does not apply to Amazon Q Business or Amazon Q Developer Pro.
50.13.1. Service Improvement. You agree and instruct that we may use Amazon Q Content to develop and improve Amazon Q and its underlying technologies, and for that purpose we may store Amazon Q Content in an AWS region outside of the AWS region where you are using Amazon Q.
50.13.2. Other Service Improvement. You agree and instruct that we may also use Amazon Q Content that does not contain personal data to develop and improve AWS and affiliate machine-learning and artificial intelligence technologies including to train machine-learning models.
50.13.3. Further Instructions. You may instruct AWS not to use and store Amazon Q Content for service improvement as described in this Section 50.13 by (i) configuring an AI services opt-out policy using AWS Organizations, (ii) if you use Amazon Q in the IDE, by adjusting your settings in the IDE, or (iii) using the opt-out mechanism described in the Amazon Q documentation.
IDE の設定やオプトアウトメカニズムの利用は、 AWS を利用する個人に委ねられるため、 Organizations のオプトアウトポリシーを利用してガバナンスを効かせたいケースもあるのではないでしょうか。
そこで今回は Organizations で用意されている AI サービスのオプトアウトポリシーを利用し、 OU 配下に属する AWS アカウント全体に AI サービスのオプトアウトを適用してみたいと思います。
AI Service オプトアウトポリシーは SCP と違い、管理アカウントにも適用可能なポリシーである点が特徴的です。
引用:Managing organization policies with AWS Organizations - AWS Organizations
やってみる
今回利用する AWS アカウントの OU 設計は以下のとおりです。
Control Tower を有効にした AWS アカウントのため、 Security OU に Audit と Log Archive アカウントが存在し、Workload OU にワークロード用アカウントがいます。
Root OU 直下には管理アカウントのみが存在している状況です。
ポリシー管理の委任
現時点では Organizations のポリシー管理は、管理アカウントのみが利用できます。リスクヘッジの観点から、管理アカウント上での操作をなるべく減らしたいため、ポリシー管理を Audit アカウントへ委任します。
適用前の Audit アカウントからみた Organizations のポリシー設定です。権限が付与されていないため、アクセス拒否されていることがわかります。
それでは設定を適用します。管理アカウントの Organizations コンソールから「設定」、「委任」をクリックします。
検証のため、次のポリシーを適用します。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DelegatingNecessaryDescribeListActions",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::MemberAccountId:root"
},
"Action": [
"organizations:DescribeOrganization",
"organizations:DescribeOrganizationalUnit",
"organizations:DescribeAccount",
"organizations:ListRoots",
"organizations:ListOrganizationalUnitsForParent",
"organizations:ListParents",
"organizations:ListChildren",
"organizations:ListAccounts",
"organizations:ListAccountsForParent",
"organizations:ListTagsForResource"
],
"Resource": "*"
},
{
"Sid": "DelegatingNecessaryDescribeListActionsForSpecificPolicyType",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::MemberAccountId:root"
},
"Action": [
"organizations:DescribePolicy",
"organizations:DescribeEffectivePolicy",
"organizations:ListPolicies",
"organizations:ListPoliciesForTarget",
"organizations:ListTargetsForPolicy"
],
"Resource": "*"
},
{
"Sid": "DelegatingAllPolicies",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::MemberAccountId:root"
},
"Action": [
"organizations:CreatePolicy",
"organizations:UpdatePolicy",
"organizations:DeletePolicy",
"organizations:AttachPolicy",
"organizations:DetachPolicy",
"organizations:EnablePolicyType",
"organizations:DisablePolicyType"
],
"Resource": "*"
}
]
}
もっと明確に絞りたい場合は、以下のブログを参考に Condition 句や Resource 句を設定すると良いかと思います。
委任ポリシーを適用すると、委任されたアカウント(今回だと Audit)の Organizations コンソールからポリシーやアカウント一覧が閲覧できるようになります。
AI サービスのオプトアウトポリシーの適用
今回は Workload OU に対して、AI サービスのオプトアウトポリシーを適用してみたいと思います。「例 1: 組織内のすべてのアカウントで、すべての AI サービスをオプトアウトする」を参考にポリシーを適用します。
{
"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"
}
}
}
}
@@
のような見慣れない文字列がありますね。ドキュメントによると次の意味があるようです。
services
直下の"@@operators_allowed_for_child_policies
を@@none
にしていると、- 子アカウントまたは子 OU に対して、個別サービス用に新しいセクション(オプトイン/アウト)の追加を禁止する
default
直下の"@@operators_allowed_for_child_policies
を@@none
にしていると、- (今後追加があった場合の)新しいセクションを追加を禁止する
- 現在は
opt_out_policy
セクションのみ使えるが、今後何かのセクションが増えた時の備えに有効
- 現在は
- (今後追加があった場合の)新しいセクションを追加を禁止する
opt_out_policy
直下の"@@operators_allowed_for_child_policies
を@@none
にしていると、- 子アカウントまたは子 OU に対して、
@@assign
キーの値(オプトイン/アウト)の変更を禁止する
- 子アカウントまたは子 OU に対して、
ポリシーを作成をクリックします。
OptOutFromAllAIServicesForWorkloadOU
という名前でポリシーを作成します。ポリシーのサイズが 2,500 文字以内のため、カウント機能がついているの良いですね。
先ほどのポリシーを入力すると、 221 文字でした。
ポリシーが作成されたので、アタッチします。
ポリシーを適用したい OU を選択し「ポリシーのアタッチ」をクリックします。
ポリシーを確認すると、ターゲット欄に対象の OU が追加されていますね。
ちなみにですが、 Organizations の AWS アカウント管理側でも、どの OU や AWS アカウントにポリシーがアタッチされているか確認できます。
AI サービスをオプトインしてみる
現在、 Workload OU にて「すべての AI サービスをオプトアウトする」を適用しています。念の為、 Workload OU 内に属する AWS アカウント(Workload01)が AI サービスをオプトインできないか確認してみます。
ポリシー管理画面から再度「ポリシーを作成」をクリックします。
OptInFromAmazonQDeveloperForWorkload01
と言う名前と、以下の内容でポリシーを作成します。
{
"services": {
"codewhisperer": {
"opt_out_policy": {
"@@assign": "optIn"
}
}
}
}
同じ要領で「ポリシーのアタッチ」を選択します。
AWS アカウント(Workload01)に適用してみます。
ポリシーは適用できましたが、「この AWS アカウントの有効な AI ポリシーを表示する」という項目がありますね。クリックしてみましょう。
中身を確認すると、 AWS アカウントに直接適用した OptInFromAmazonQDeveloperForWorkload01
は無効化され、 OU から継承した OptOutFromAllAIServicesForWorkloadOU
の内容が適用されています。
まとめ
以上、「AI サービスのオプトアウトポリシーを OU に適用してみる」でした。
AWS の AI サービスを積極的に利用したいが、ガバナンスも気になる方には必須の機能ですね。
このブログがどなたかの参考になれば幸いです。
クラウド事業本部コンサルティング部のたかくに(@takakuni_)でした!
Amazon Q Business または Amazon Q Developer Pro は対象外です。 ↩︎