翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
データソースにアクセスするための IAM アクセス許可を設定する (管理者向け)
管理者は、JupyterLab アプリケーションで使用される実行ロールに、設定されたAWS Glue接続を介してデータにアクセスするために必要な AWSIAM アクセス許可があることを確認する必要があります。
-
を使用して管理者が作成した接続AWS CLI: 管理者が作成したAWS Glue接続を表示してデータにアクセスするには、Studio の JupyterLab アプリケーションで使用される SageMaker AI 実行ロールに管理者が特定のアクセス許可をアタッチする必要があります。これにはAWS Glue、、Secrets Manager、およびデータベース固有のアクセス許可へのアクセスが含まれます。管理者が作成した接続は、特定の AWS Glue カタログまたはデータベースを表示するアクセス許可を付与された実行ロールを共有するすべてのアプリケーションに表示されます。データソースのタイプごとに必要なアクセス許可のリストについては、「管理者定義の接続に必要な IAM アクセス許可」の「管理者定義の接続許可」を参照してください。
-
JupyterLab の SQL 拡張機能 UI を使用してユーザーが作成した接続: 同じ実行ロールを共有するユーザープロファイルによって作成された接続も、その接続の表示範囲がユーザーによって作成された接続のみに限定されていない限り、一覧表示されます。ユーザーが作成した接続には、その接続を作成したユーザープロファイルのタグが付けられます。ユーザーが作成した接続を表示、更新、削除する機能を、それらを作成したユーザーのみに制限するには、管理者は実行ロールの IAM アクセス許可にタグベースのアクセスコントロール制限を追加できます。必要な追加のタグベースのアクセスコントロールについては、「ユーザー定義の接続にに必要な IAM アクセス許可」を参照してください。
管理者定義の接続に必要な IAM アクセス許可
Studio の JupyterLab アプリケーションで使用される SageMaker AI 実行ロールに、 AWS Glue接続を介してデータソースへのアクセスを許可するには、次のインラインポリシーをロールにアタッチします。
各データソースまたは認証方法の特定のアクセス許可とポリシーの詳細を表示するには、以下の関連する接続タイプを選択します。
ポリシーのアクセス許可は、必要なリソースとアクションのみに制限することをお勧めします。
ポリシーをスコープダウンして、最小特権のアクセスを許可するには、ポリシー内のワイルドカード "Resource": ["*"] を特定の ARN に置き換えて、アクセスが必要なリソースを正確に指定します。リソースへのアクセスを制御する方法の詳細については、「きめ細かな ARN アクセス許可でAWSリソースアクセスを微調整する」を参照してください。
このポリシーは、必要なアクションとリソースのみとするようにスコープダウンすることを強くお勧めします。
- JSON
-
-
{
"Version":"2012-10-17",
"Statement": [
{
"Sid": "GetS3AndDataSourcesMetadata",
"Effect": "Allow",
"Action": [
"glue:GetDatabases",
"glue:GetSchema",
"glue:GetTables",
"s3:ListBucket",
"s3:GetObject",
"s3:GetBucketLocation",
"glue:GetDatabase",
"glue:GetTable",
"glue:ListSchemas",
"glue:GetPartitions"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-bucket/*",
"arn:aws:glue:us-east-1:111122223333:catalog",
"arn:aws:glue:us-east-1:111122223333:connection/*"
]
},
{
"Sid": "ExecuteQueries",
"Effect": "Allow",
"Action": [
"athena:ListDataCatalogs",
"athena:ListDatabases",
"athena:ListTableMetadata",
"athena:StartQueryExecution",
"athena:GetQueryExecution",
"athena:RunQuery",
"athena:StartSession",
"athena:GetQueryResults",
"athena:ListWorkGroups",
"s3:ListMultipartUploadParts",
"s3:ListBucket",
"s3:GetBucketLocation",
"athena:GetDataCatalog",
"s3:AbortMultipartUpload",
"s3:GetObject",
"s3:PutObject",
"athena:GetWorkGroup"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-bucket/*",
"arn:aws:athena:us-east-1:111122223333:workgroup/workgroup-name"
]
},
{
"Sid": "GetGlueConnections",
"Effect": "Allow",
"Action": [
"glue:GetConnections",
"glue:GetConnection"
],
"Resource": [
"arn:aws:glue:us-east-1:111122223333:catalog",
"arn:aws:glue:us-east-1:111122223333:connection/*"
]
},
{
"Sid": "GetSecrets",
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": [
"arn:aws:secretsmanager:us-east-1:111122223333:secret:secret-name"
]
},
{
"Sid": "GetClusterCredentials",
"Effect": "Allow",
"Action": [
"redshift:GetClusterCredentials"
],
"Resource": [
"arn:aws:redshift:us-east-1:111122223333:cluster:cluster-name"
]
}
]
}
このポリシーは、必要なリソースのみとするようにスコープダウンすることを強くお勧めします。
詳細については、「Athena ドキュメント」の「IAM アクセス許可ポリシーの例」を参照してください。
- JSON
-
-
{
"Version":"2012-10-17",
"Statement": [
{
"Sid": "GetS3AndDataSourcesMetadata",
"Effect": "Allow",
"Action": [
"glue:GetDatabases",
"glue:GetSchema",
"glue:GetTables",
"s3:ListBucket",
"s3:GetObject",
"s3:GetBucketLocation",
"glue:GetDatabase",
"glue:GetTable",
"glue:ListSchemas",
"glue:GetPartitions"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-bucket/*",
"arn:aws:glue:us-east-2:111122223333:catalog",
"arn:aws:glue:us-east-2:111122223333:connection/*"
]
},
{
"Sid": "ExecuteAthenaQueries",
"Effect": "Allow",
"Action": [
"athena:ListDataCatalogs",
"athena:ListDatabases",
"athena:ListTableMetadata",
"athena:StartQueryExecution",
"athena:GetQueryExecution",
"athena:RunQuery",
"athena:StartSession",
"athena:GetQueryResults",
"athena:ListWorkGroups",
"s3:ListMultipartUploadParts",
"s3:ListBucket",
"s3:GetBucketLocation",
"athena:GetDataCatalog",
"s3:AbortMultipartUpload",
"s3:GetObject",
"s3:PutObject",
"athena:GetWorkGroup"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-bucket/*",
"arn:aws:athena:us-east-2:111122223333:workgroup/workgroup-name"
]
},
{
"Sid": "GetGlueConnections",
"Effect": "Allow",
"Action": [
"glue:GetConnections",
"glue:GetConnection"
],
"Resource": [
"arn:aws:glue:us-east-2:111122223333:catalog",
"arn:aws:glue:us-east-2:111122223333:connection/*"
]
},
{
"Sid": "GetSecrets",
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": [
"arn:aws:secretsmanager:us-east-2:111122223333:secret:secret-name"
]
}
]
}
このポリシーは、必要なリソースのみとするようにスコープダウンすることを強くお勧めします。
- JSON
-
-
{
"Version":"2012-10-17",
"Statement": [
{
"Sid": "GetS3Metadata",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-bucket/*"
]
},
{
"Sid": "GetGlueConnections",
"Effect": "Allow",
"Action": [
"glue:GetConnections",
"glue:GetConnection"
],
"Resource": [
"arn:aws:glue:us-east-2:111122223333:catalog",
"arn:aws:glue:us-east-2:111122223333:connection/*"
]
},
{
"Sid": "GetSecrets",
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": [
"arn:aws:secretsmanager:us-east-2:111122223333:secret:secret-name"
]
}
]
}
このポリシーは、必要なリソースのみとするようにスコープダウンすることを強くお勧めします。
- JSON
-
-
{
"Version":"2012-10-17",
"Statement": [
{
"Sid": "GetS3Metadata",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-bucket/*",
"arn:aws:s3:::amzn-s3-demo-bucket/*"
]
},
{
"Sid": "GetGlueConnections",
"Effect": "Allow",
"Action": [
"glue:GetConnections",
"glue:GetConnection"
],
"Resource": [
"arn:aws:glue:us-east-1:111122223333:catalog",
"arn:aws:glue:us-east-1:111122223333:connection/*",
"arn:aws:glue:us-east-1:111122223333:connection/connection-name"
]
},
{
"Sid": "GetSecrets",
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": [
"arn:aws:secretsmanager:us-east-1:111122223333:secret:secret-name",
"arn:aws:secretsmanager:us-east-1:111122223333:secret:secret-name-with-suffix"
]
},
{
"Sid": "GetClusterCredentials",
"Effect": "Allow",
"Action": [
"redshift:GetClusterCredentials"
],
"Resource": [
"arn:aws:redshift:us-east-1:111122223333:cluster:cluster-name",
"arn:aws:redshift:us-east-1:111122223333:dbuser:cluster-name/db-user-name"
]
}
]
}
このポリシーは、必要なリソースのみとするようにスコープダウンすることを強くお勧めします。
- JSON
-
-
{
"Version":"2012-10-17",
"Statement": [
{
"Sid": "GetS3Metadata",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-bucket/*"
]
},
{
"Sid": "GetGlueConnections",
"Effect": "Allow",
"Action": [
"glue:GetConnections",
"glue:GetConnection"
],
"Resource": [
"arn:aws:glue:us-east-2:111122223333:catalog",
"arn:aws:glue:us-east-2:111122223333:connection/*"
]
},
{
"Sid": "GetSecrets",
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": [
"arn:aws:secretsmanager:us-east-2:111122223333:secret:secret-name"
]
},
{
"Sid": "GetRedshiftServerlessCredentials",
"Effect": "Allow",
"Action": [
"redshift-serverless:GetCredentials"
],
"Resource": [
"arn:aws:redshift-serverless:us-east-2:111122223333:namespace/namespace-id"
]
}
]
}
ユーザー定義の接続にに必要な IAM アクセス許可
ユーザーの IAM ポリシーのアクセス許可は、AWS Glue接続リソースに UserProfile タグが存在することを考慮できます。
-
AWS Glue接続を表示するには:
-
ユーザーは、(管理者が作成した) UserProfile タグが付けられていないすべての接続を表示できます。
-
ユーザーは、ユーザープロファイル名と同じ値を持つ UserProfile タグが付けられた接続を表示できます。
-
ユーザーは、自分自身のユーザープロファイル名とは異なる値の UserProfile タグが付けられた接続を表示できません。
-
AWS Glue接続を更新または削除するには:
-
ユーザーは、自分自身のユーザープロファイル名と同じ値の UserProfile タグが付けられた接続を更新または削除できます。
-
ユーザーは、自分自身のユーザープロファイル名とは異なる値の UserProfile タグが付けられた接続を更新または削除することはできません。
-
ユーザーは UserProfile タグが付けられていない接続を更新または削除することはできません。
これを実現するには、管理者はユーザープロファイルの JupyterLab アプリケーションで使用される実行ロールに、既存の管理者定義の接続許可を超える追加の許可を付与する必要があります。具体的には、管理者定義AWS Glueの接続にアクセスするために必要なアクセス許可に加えて、次の 2 つの追加の IAM アクセス許可をユーザーの実行ロールに付与する必要があります。
このアクセス許可は、特定のユーザープロファイルタグ値に基づいてAWS Glue接続へのアクセスを制限します。ターゲットにするユーザーのプロファイル名で UserProfile タグ値を更新します。
"Action": [
"glue:GetConnection",
"glue:GetConnections"
],
"Resource": [
"arn:aws:glue:region:account_id:connection/*"
],
"Condition": {
"StringEqualsIfExists": {
"aws:ResourceTag/UserProfile": "user_profile_name"
}
}
このアクセス許可は、ユーザーが作成した接続を作成、更新、削除する機能を、指定された UserProfile タグ値を持つユーザープロファイルが作成した接続のみに制限します。
"Action": [
"glue:DeleteConnection",
"glue:UpdateConnection",
"glue:CreateConnection",
"glue:TagResource"
],
"Resource": [
"arn:aws:glue:region:account_id:connection/*"
],
"Condition": {
"StringEquals": {
"aws:ResourceTag/UserProfile": "user_profile"
}
}
きめ細かな ARN アクセス許可でAWSリソースアクセスを微調整する
AWSリソースへのアクセスをよりきめ細かく制御するには、ポリシー"Resource": ["*"]内のワイルドカードリソースを、アクセスを必要とするリソースのみの特定の Amazon リソースネーム (ARNsに置き換えます。ワイルドカードではなく正確な ARN を使用すると、意図するリソースへのアクセスを制限できます。
-
特定の Amazon S3 バケットの ARN を使用する
例えば、バケットレベルまたはオブジェクトレベルのオペレーションの場合、"arn:aws:s3:::bucket-name" または
"arn:aws:s3:::bucket-name/*" を使用します。
Amazon S3 のすべてのリソースタイプの詳細については、「Amazon S3 で定義されるリソースタイプ」を参照してください。
-
特定のAWS Glueデータベース ARNs
例えば、 "arn:aws:glue:region:account-id:catalog"、
"arn:aws:glue:region:account-id:database/db-name" などです。のすべてのリソースタイプの詳細についてはAWS Glue、「 で定義されるリソースタイプAWS Glue」を参照してください。
-
特定の Athena ワークグループの ARN を使用する
例: "arn:aws:athena:region:account-id:workgroup/workgroup-name"。Athena のすべてのリソースタイプの詳細については、「Resource types defined by Athena」を参照してください。
-
特定の AWSSecrets Manager シークレット ARNs
例: "arn:aws:secretsmanager:region:account-id:secret:secret-name"。AWSSecrets Manager のすべてのリソースタイプの詳細については、AWS「Secrets Manager で定義されるリソースタイプ」を参照してください。
-
特定の Amazon Redshift クラスターの ARN を使用する
例: "arn:aws:redshift:region:account-id:cluster:cluster-name"。Amazon Redshift のリソースタイプの詳細については、「Resource types defined by Amazon Redshift」を参照してください。Redshift Serverless のすべてのリソースタイプの詳細については、「Resource types defined by Redshift Serverless」を参照してください。