Skip to content

AwsCustomResource: deploying S3 ReplicationConfiguration for existing bucket #28282

Answered by luukau
luukau asked this question in Q&A
Discussion options

You must be logged in to vote

Okay so I found a solution for my problem, just in case someone else is running into the same:

In Stack A, I create a property of type CfnBucket that can be consumed by another stack, like so.

export class StackA extends Stack {
  public readonly cfnSourceBucket: s3.CfnBucket;

  const sourceBucket = new s3.Bucket(
      this,
      ...
    );

   this.cfnSourceBucket = sourceBucket.node.defaultChild as s3.CfnBucket;
   ...
}

Stack B:

interface StackBProps extends cdk.StackProps {
  cfnSourceBucket: s3.CfnBucket;
  ...
}

export class StackB extends cdk.Stack {
  constructor(scope: Construct, id: string, props: StackBProps) {
    super(scope, id, props);
   
   ...
    props.cfnSourceBuc…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@avirtual
Comment options

@avirtual
Comment options

Answer selected by luukau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants