S3DownloadOptions

class aws_cdk.aws_ec2.S3DownloadOptions(*, bucket, bucket_key, local_file=None, region=None)

Bases: object

Options when downloading files from S3.

Parameters:
  • bucket (IBucket) – Name of the S3 bucket to download from.

  • bucket_key (str) – The key of the file to download.

  • local_file (Optional[str]) – The name of the local file. Default: Linux - /tmp/bucketKey Windows - %TEMP%/bucketKey

  • region (Optional[str]) – The region of the S3 Bucket (needed for access via VPC Gateway). Default: none

ExampleMetadata:

infused

Example:

from aws_cdk.aws_s3_assets import Asset

# instance: ec2.Instance


asset = Asset(self, "Asset",
    path="./configure.sh"
)

local_path = instance.user_data.add_s3_download_command(
    bucket=asset.bucket,
    bucket_key=asset.s3_object_key,
    region="us-east-1"
)
instance.user_data.add_execute_file_command(
    file_path=local_path,
    arguments="--verbose -y"
)
asset.grant_read(instance.role)

Attributes

bucket

Name of the S3 bucket to download from.

bucket_key

The key of the file to download.

local_file

The name of the local file.

Default:

Linux - /tmp/bucketKey Windows - %TEMP%/bucketKey

region

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

Default:

none