Skip to content
v2.273.0

FileAssetSource Struct ​

Represents the source for a file asset.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const fileAssetSource: cdk.FileAssetSource = {
  sourceHash: 'sourceHash',

  // the properties below are optional
  deployTime: false,
  displayName: 'displayName',
  executable: ['executable'],
  fileName: 'fileName',
  packaging: cdk.FileAssetPackaging.ZIP_DIRECTORY,
};

Properties ​

deployTimebooleandeploy_timebooldeployTimeBooleanDeployTimeboolDeployTime*bool= false#
Whether or not the asset needs to exist beyond deployment time;
notes

i.e. are copied over to a different location and not needed afterwards. Setting this property to true has an impact on the lifecycle of the asset, because we will assume that it is safe to delete after the CloudFormation deployment succeeds.

For example, Lambda Function assets are copied over to Lambda during deployment. Therefore, it is not necessary to store the asset in S3, so we consider those deployTime assets.

displayNamestringdisplay_namestrdisplayNameStringDisplayNamestringDisplayName*string= The asset hash is used to displa…#
A display name for this asset.

If supplied, the display name will be used in locations where the asset identifier is printed, like in the CLI progress information.

default

Default: The asset hash is used to display the asset

executablestring[]executabletyping.List[str]executableList<String>Executablestring[]Executable*[]*string= Exactly one of `fileName` and `e…#
An external command that will produce the packaged asset.

The command should produce the location of a ZIP file on stdout.

default

Default: Exactly one of fileName and executable is required

fileNamestringfile_namestrfileNameStringFileNamestringFileName*string= Exactly one of `fileName` and `e…#
The path, relative to the root of the cloud assembly, in which this asset source resides.

This can be a path to a file or a directory, depending on the packaging type.

default

Default: Exactly one of fileName and executable is required

packagingFileAssetPackagingpackagingFileAssetPackagingpackagingFileAssetPackagingPackagingFileAssetPackagingPackagingFileAssetPackaging= Required if `fileName` is specif…#
Which type of packaging to perform.
default

Default: Required if fileName is specified.

sourceHashstringsource_hashstrsourceHashStringSourceHashstringSourceHash*stringrequired#
A hash on the content source.

This hash is used to uniquely identify this asset throughout the system. If this value doesn't change, the asset will not be rebuilt or republished.