How to implement S3 replication for existing objects in CDK?

0
  1. I already can replicate existing objects from aws console by setting up a batch job.

  2. But how to do the same thing in CDK?

  3. Currently, in CDK, I can only implement live replication for a new created bucket, not for existing objects. Here is

// create a new bucket and add replication rule 
// How to do replication for an existed bucket? 
const source = new cdk.aws_s3.CfnBucket(this, "SourceBucketNew", {
      bucketName: `replication-source-bucket-${this.account}`,
      versioningConfiguration: {
        status: "Enabled",
      },
      replicationConfiguration: {
        role: role.roleArn,
        rules: [
          {
            destination: {
              bucket: dest.bucketArn,
            },
            status: "Enabled",
          },
        ],
      },
    });
hai
質問済み 2年前285ビュー
1回答
0

If you did not create the bucket with the CDK app, it is not possible to change the replication without a direct API call outside of CloudFormation. You would need to make that change using an AWSCustomResource.

There is a bit more context as to why this is the case here: https://github.com/aws/aws-cdk/issues/10348#issuecomment-692672755

profile pictureAWS
回答済み 2年前

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

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

質問に答えるためのガイドライン

関連するコンテンツ