class ComponentData
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ImageBuilder.Alpha.ComponentData |
Go | github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2#ComponentData |
Java | software.amazon.awscdk.services.imagebuilder.alpha.ComponentData |
Python | aws_cdk.aws_imagebuilder_alpha.ComponentData |
TypeScript (source) | @aws-cdk/aws-imagebuilder-alpha ยป ComponentData |
Helper class for referencing and uploading component data.
Example
const component = new imagebuilder.Component(this, 'EncryptedComponent', {
platform: imagebuilder.Platform.LINUX,
kmsKey: new kms.Key(this, 'ComponentKey'),
data: imagebuilder.ComponentData.fromJsonObject({
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
phases: [
{
name: imagebuilder.ComponentPhaseName.BUILD,
steps: [
{
name: 'secure-setup',
action: imagebuilder.ComponentAction.EXECUTE_BASH,
inputs: {
commands: ['echo "This component data is encrypted with KMS"']
}
}
]
}
]
})
});
Initializer
new ComponentData()
Methods
| Name | Description |
|---|---|
| render() | The rendered component data value, for use in CloudFormation. |
| static from | Uploads component data from a local file to S3 to use as the component data. |
| static from | Uses an inline JSON object as the component data, using the ComponentDocument interface. |
| static from | Uses an inline JSON/YAML string as the component data. |
| static from | Uses an inline JSON object as the component data. |
| static from | References component data from a pre-existing S3 object. |
render()
public render(): ComponentDataConfig
Returns
The rendered component data value, for use in CloudFormation.
- For inline components, data is the component text
- For S3-backed components, uri is the S3 URL
static fromAsset(scope, id, path, options?)
public static fromAsset(scope: Construct, id: string, path: string, options?: AssetOptions): S3ComponentData
Parameters
- scope
Constructโ The construct scope. - id
stringโ Identifier of the construct. - path
stringโ The local path to the component data file. - options
Assetโ S3 asset upload options.Options
Returns
Uploads component data from a local file to S3 to use as the component data.
static fromComponentDocumentJsonObject(data)
public static fromComponentDocumentJsonObject(data: ComponentDocument): ComponentData
Parameters
- data
Componentโ An inline JSON object representing the component data.Document
Returns
Uses an inline JSON object as the component data, using the ComponentDocument interface.
static fromInline(data)
public static fromInline(data: string): ComponentData
Parameters
- data
stringโ An inline JSON/YAML string representing the component data.
Returns
Uses an inline JSON/YAML string as the component data.
static fromJsonObject(data)
public static fromJsonObject(data: { [string]: any }): ComponentData
Parameters
- data
{ [string]: any }โ An inline JSON object representing the component data.
Returns
Uses an inline JSON object as the component data.
static fromS3(bucket, key)
public static fromS3(bucket: IBucket, key: string): S3ComponentData
Parameters
- bucket
IBucketโ The S3 bucket where the component data is stored. - key
stringโ The S3 key of the component data file.
Returns
References component data from a pre-existing S3 object.

.NET
Go
Java
Python
TypeScript (