question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-s3-deployment): BucketDeployment fails for new bucket in same stack

See original GitHub issue
bucket = aws_s3.Bucket(
                self,
                id=domain,
                bucket_name=domain,
                website_index_document="hello_world.html",
                public_read_access=True
            )
aws_s3_deployment.BucketDeployment(
            self,
            id="{}-bucket-deployment".format(domain),
            destination_bucket=bucket,
            sources=[aws_s3_deployment.Source.asset("./static")]  # static file directory
        )

Running the above in the same stack creates the bucket but fails during creation of the bucket deployment with

CREATE_FAILED        | Custom::CDKBucketDeployment   | <domain>...omResource/Default
Failed to create resource. Command '['/opt/awscli/aws', 's3', 'sync', '--delete', '/tmp/tmpvnmebqim/contents', 's3://<bucket-name>/']' returned non-zero exit status 1.

What did you expect to happen?

CDK deployment to succeed to upload static files to the newly created s3 bucket

Environment

  • CDK CLI Version: 1.91.0
  • Framework Version: 1.91.0
  • Node.js Version: v15.4.0
  • OS : mac OS 10.15.6
  • Language (Version): Python 3.8.6

This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
seriouscoderonecommented, Mar 6, 2021

I think I see my problem, I changed the KMS key on my bucket, that would probably explain what has happened.

0reactions
github-actions[bot]commented, Mar 16, 2021

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk/aws-s3-deployment module - AWS Documentation
When the BucketDeployment is removed from the stack, the contents are retained in the destination bucket (#952). If you are using s3deploy.Source.bucket() to ......
Read more >
How to use the @aws-cdk/aws-s3-deployment ... - Snyk
BucketDeployment function in @aws-cdk/aws-s3-deployment ... Construct, id: string, props: {}) { const stack = new cdk.Stack(scope, id, props); // TODO: ...
Read more >
When I add this BucketDeployment to my CDK CodePipeline ...
According to the BucketDeployment docs the assets are uploaded to an intermediary bucket and then later merged to your bucket. This matters ...
Read more >
AWS CDK v2 Tutorial – How to Create a Three-Tier Serverless ...
This familiar pattern is fertile ground for learning new technologies ... import { RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; ...
Read more >
cdk-s3bucket-ng - npm
But We forget delete Object in S3 Bucket first , so destroy will fail. ... and the usage is almost the same as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found