スキップしてコンテンツを表示

s3 cross account access

-1

how to configure s3 access to airflow which is in different account. please help with cdk code to use s3 is in account A and airflow in account B

1回答
0

Hello.

I think you'll be able to use it if you configure the S3 bucket policy to allow the IAM role used by MWAA.
For example, if you configure the bucket policy as follows, access from MWAA in account B to S3 in account A will be permitted.

import * as s3 from 'aws-cdk-lib/aws-s3';
import * as iam from 'aws-cdk-lib/aws-iam';

const bucket = new s3.Bucket(this, 'S3bucketname');

// MWAA role ARN for Account B
const mwaaRoleArn = 'arn:aws:iam::ACCOUNT_B_ID:role/MWAARole';

bucket.addToResourcePolicy(new iam.PolicyStatement({
  principals: [new iam.ArnPrincipal(mwaaRoleArn)],
  actions: [
    's3:GetObject',
    's3:ListBucket'
  ],
  resources: [
    bucket.bucketArn,
    `${bucket.bucketArn}/*`
  ],
}));
エキスパート
回答済み 1ヶ月前
エキスパート
レビュー済み 1ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ