How to use @aws-cdk/aws-s3-assets - 1 common examples

To help you get started, we’ve selected a few @aws-cdk/aws-s3-assets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / @aws-cdk / aws-s3-deployment / lib / source.ts View on Github external
bind(context: cdk.Construct): SourceConfig {
        let id = 1;
        while (context.node.tryFindChild(`Asset${id}`)) {
          id++;
        }
        const asset = new s3_assets.Asset(context, `Asset${id}`, { path });
        if (!asset.isZipArchive) {
          throw new Error(`Asset path must be either a .zip file or a directory`);
        }
        return {
          bucket: asset.bucket,
          zipObjectKey: asset.s3ObjectKey
        };
      }
    };

@aws-cdk/aws-s3-assets

Deploy local files and directories to S3

Apache-2.0
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis

Popular @aws-cdk/aws-s3-assets functions