Data Federation や 保管時の暗号化 などの一部の Atlas 機能は、 Amazon Web Services IAM ロール で認証されます。Atlas がAmazon Web Servicesサービスにアクセスする場合、 IAM ロール を想定します。
You can set up an assumed IAM role for your Atlas account to use with the Atlas Administration API or Atlas UI if you have the Project Owner role. Atlas supports unified access only for AWS.
You can use Atlas Kubernetes Operator to set up unified access for an AWS IAM role in the AtlasProject Custom Resource.
重要
If you operate Atlas Kubernetes Operator under an independent CRD model, you cannot configure AWS IAM authentication using atlasProject parameters. To configure AWS IAM authentication for your Atlas project directly, please see Set Up Authentication with AWS IAM.
前提条件
Atlas Kubernetes Operator から Atlas へのアクセスを構成するには、次の公開 API キー、プライベート API キー、および組織 ID 情報が必要です。
Atlas Kubernetes Operator で新しい Atlasプロジェクトを作成する場合は、 組織へのプログラムによるアクセスの付与 。組織で Atlas Administration APIのIP アクセス リストが必要な場合は、 APIアクセス リストも設定する必要があります。
重要
API キーには、 Organization Project Creator組織ロール以上を割り当てる必要があります。
既存の Atlasプロジェクトを操作する場合は、 プロジェクトからプロジェクト アクセスを追加 します。組織で Atlas Administration APIのIP アクセス リストが必要な場合は、 APIアクセス リストも設定する必要があります。
重要
Project Ownerプロジェクト ロールに API キーを割り当てる必要があります。
API キーの代わりに、サービス アカウントを使用することもできます。
詳細については、「 Atlas へのアクセスの設定 」を参照してください。
手順
spec.cloudProviderIntegrations フィールドを AtlasProject カスタムリソースに追加します。
spec.cloudProviderIntegration.iamAssumedRoleArn 内で空の値プレースホルダーを指定します
AtlasProjectカスタム リソースの パラメータ。spec.cloudProviderIntegration.providerName 内で
AWSを指定しますAtlasProjectカスタム リソースの パラメータ。
例:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Project projectIpAccessList: - ipAddress: "192.0.2.15" comment: "IP address for Application" cloudProviderIntegrations: - providerName: "AWS" iamAssumedRoleArn: "" EOF
重要
AtlasProjectカスタム リソースに追加のアクセス ロールを追加する前に、空の値プレースホルダーのロールを構成する手順全体を完了します。
プロジェクトの atlasAWSAccountArn と atlasAssumedRoleExternalId を検索します。
コマンドを実行して
atlasAWSAccountArnを取得します。これは次のステップで必要です。kubectl get atlasprojects my-project -o=jsonpath='{.status.cloudProviderIntegrations.atlasAWSAccountArn.type}' arn:aws:iam::198765432109:root コマンドを実行して
atlasAssumedRoleExternalIdを取得します。これは次のステップで必要です。kubectl get atlasprojects my-project -o=jsonpath='{.status.cloudProviderIntegrations.atlasAssumedRoleExternalId.type}' 1a234b56-c789-0d12-345e-67f89012345a
Modify your AWS IAM role trust policy.
統合アクセス用に既存のIAMロールを使用することも、新しいIAMロールを作成することもできます。
次のカスタム信頼ポリシーを使用して、Amazon Web Services IAM ロールの信頼ポリシーを変更します。強調表示された行を、前の手順で取得した値に置き換えます。
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Principal":{ "AWS":"<atlasAWSAccountArn>" }, "Action":"sts:AssumeRole", "Condition":{ "StringEquals":{ "sts:ExternalId":"<atlasAssumedRoleExternalId>" } } } ] }
次のカスタム信頼ポリシーを使用して、Amazon Web Services IAM ロールを作成します。強調表示された行を、前の手順で取得した値に置き換えます。
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Principal":{ "AWS":"<atlasAWSAccountArn>" }, "Action":"sts:AssumeRole", "Condition":{ "StringEquals":{ "sts:ExternalId":"<atlasAssumedRoleExternalId>" } } } ] }
Atlas Kubernetes Operator を使用して、IAM ロールのアクセスを認証します。
spec.cloudProviderIntegration.iamAssumedRoleArn 内の空の値プレースホルダーを置き換えますAtlasProject前のステップの IAM ロールの AWS ARN を持つ カスタム リソース のパラメータ。
例:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasProject metadata: name: my-project spec: name: Test Project projectIpAccessList: - ipAddress: "192.0.2.15" comment: "IP address for Application" cloudProviderIntegrations: - providerName: "AWS" iamAssumedRoleArn: "arn:aws:iam::123456789012:role/aws-service-role/support.amazonaws.com/myRole" EOF
cloudProviderIntegrations のステータスを確認します。
ステータスを取得するには、 コマンドを実行します。
kubectl get atlasprojects my-project -o=jsonpath='{.status.cloudProviderIntegrations}' READYのステータスを確認します。ステータスが
CREATEDの場合、 Atlasはロールを作成しましたが、 Amazon Web Services内で承認されていません。ステータスが
EMPTY_ARNの場合、Atlas はロールを作成しましたが、spec.cloudProviderIntegrations.iamAssumedRoleArnは指定されていません。ステータスが
READYの場合、 Atlasはロールを作成し、ユーザーがAmazon Web Services内でそれを承認しています。