S3 Deployment: Deployment fails with [Errno 2] No such file or directory: '/opt/awscli/aws'

I’m using cdklocal with localstack to deploy my cdk stack in my local environment. When executing the S3 Deployment, I get the error [Errno 2] No such file or directory: '/opt/awscli/aws'. The stack will still deploy locally, but no files will be deployed to my s3 bucket. The deployment works just fine if I deploy to my AWS account.

new s3deploy.BucketDeployment(this, 'WebsiteDeployment', {
      sources: [s3deploy.Source.asset('./app/build')],
      destinationBucket: bucket,
      distribution,
      distributionPaths: ['/*']
 });

Why am I getting this error?

Expected Behavior

The S3 Deployment should upload the contents of ./app/build to my bucket.

Current Behavior

The bucket is created but the contents of ./app/build is not uploaded to my bucket.

Reproduction Steps

  1. localstack start
  2. cdklocal deploy

Stack:

const bucket = new s3.Bucket(this, 'Bucket', {
  publicReadAccess: true,
  removalPolicy: RemovalPolicy.DESTROY,
  websiteIndexDocument: 'index.html'
});

new s3deploy.BucketDeployment(this, 'Deployment', {
  sources: [s3deploy.Source.asset('./app/build')],
  destinationBucket: bucket
});

CDK CLI Version

2.22.0 (build 1db4b16)

Node.js Version

v16.15.0

OS

Mac OS Monterey

Language

Typescript

Hi @garyholiday , thanks for reporting.

Can you please share the output of this command:

ls -la /opt/awscli/aws

Please note that you’ll need to install both, the aws-cdk-local, as well as the aws-cdk npm package

npm install -g aws-cdk-local aws-cdk

Can you please share the full logs of the cdklocal deploy command, as well as the log output of your LocalStack Docker container (with DEBUG=1 enabled in the environment)? Thanks!

When I run ls -la /opt/awscli/aws I get: ls: /opt/awscli/aws: No such file or directory. However, I’m able to deploy the stack just fine to AWS.

I have both aws-cdk-local and aws-cdk installed.

Here is a link to a paste bin with the entire localstack log: ~/repos/Docrio-Preview $ DEBUG=1 localstack start __ - Pastebin.com

Also, the cdk-local command deploys successfully and does not show any errors.