aws-cdk-lib.aws_ec2.S3DownloadOptions

interface S3DownloadOptions

LanguageType name
.NETAmazon.CDK.AWS.EC2.S3DownloadOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#S3DownloadOptions
Javasoftware.amazon.awscdk.services.ec2.S3DownloadOptions
Pythonaws_cdk.aws_ec2.S3DownloadOptions
TypeScript (source)aws-cdk-lib » aws_ec2 » S3DownloadOptions

Options when downloading files from S3.

Example

import { Asset } from 'aws-cdk-lib/aws-s3-assets';

declare const instance: ec2.Instance;

const asset = new Asset(this, 'Asset', {
  path: './configure.sh'
});

const localPath = instance.userData.addS3DownloadCommand({
  bucket:asset.bucket,
  bucketKey:asset.s3ObjectKey,
  region: 'us-east-1', // Optional
});
instance.userData.addExecuteFileCommand({
  filePath:localPath,
  arguments: '--verbose -y'
});
asset.grantRead(instance.role);

Properties

NameTypeDescription
bucketIBucketName of the S3 bucket to download from.
bucketKeystringThe key of the file to download.
localFile?stringThe name of the local file.
region?stringThe region of the S3 Bucket (needed for access via VPC Gateway).

bucket

Type: IBucket

Name of the S3 bucket to download from.


bucketKey

Type: string

The key of the file to download.


localFile?

Type: string (optional, default: Linux - /tmp/bucketKey Windows - %TEMP%/bucketKey)

The name of the local file.


region?

Type: string (optional, default: none)

The region of the S3 Bucket (needed for access via VPC Gateway).