class Component (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ImageBuilder.Alpha.Component |
Go | github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2#Component |
Java | software.amazon.awscdk.services.imagebuilder.alpha.Component |
Python | aws_cdk.aws_imagebuilder_alpha.Component |
TypeScript (source) | @aws-cdk/aws-imagebuilder-alpha ยป Component |
Implements
IConstruct, IDependable, IResource, IEnvironment, IComponent
Represents an EC2 Image Builder Component.
Example
const component = new imagebuilder.Component(this, 'MyComponent', {
platform: imagebuilder.Platform.LINUX,
data: imagebuilder.ComponentData.fromJsonObject({
schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
phases: [
{
name: imagebuilder.ComponentPhaseName.BUILD,
steps: [
{
name: 'install-app',
action: imagebuilder.ComponentAction.EXECUTE_BASH,
inputs: {
commands: ['echo "Installing my application..."', 'yum update -y'],
},
},
],
},
],
}),
});
Initializer
new Component(scope: Construct, id: string, props: ComponentProps)
Parameters
- scope
Construct - id
string - props
ComponentProps
Construct Props
| Name | Type | Description |
|---|---|---|
| data | Component | The component document content that defines the build, validation, or test steps to be executed during the image building process. |
| platform | Platform | The operating system platform of the component. |
| change | string | The change description of the component. |
| component | string | The name of the component. |
| component | string | The version of the component. |
| description? | string | The description of the component. |
| kms | IKey | The KMS key used to encrypt this component. |
| supported | OSVersion[] | The operating system versions supported by the component. |
| tags? | { [string]: string } | The tags to apply to the component. |
data
Type:
Component
The component document content that defines the build, validation, or test steps to be executed during the image building process.
platform
Type:
Platform
The operating system platform of the component.
changeDescription?
Type:
string
(optional, default: None)
The change description of the component.
Describes what change has been made in this version of the component, or what makes this version different from other versions.
componentName?
Type:
string
(optional, default: a name is generated)
The name of the component.
componentVersion?
Type:
string
(optional, default: 1.0.0)
The version of the component.
description?
Type:
string
(optional, default: None)
The description of the component.
kmsKey?
Type:
IKey
(optional, default: an Image Builder owned key will be used to encrypt the component.)
The KMS key used to encrypt this component.
supportedOsVersions?
Type:
OSVersion[]
(optional, default: None)
The operating system versions supported by the component.
tags?
Type:
{ [string]: string }
(optional, default: None)
The tags to apply to the component.
Properties
| Name | Type | Description |
|---|---|---|
| component | string | The ARN of the component. |
| component | string | The name of the component. |
| component | string | The type of the component. |
| component | string | The version of the component. |
| encrypted | boolean | Whether the component is encrypted. |
| env | Resource | The environment this resource belongs to. |
| node | Node | The tree node. |
| stack | Stack | The stack in which this resource is defined. |
| kms | IKey | |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
componentArn
Type:
string
The ARN of the component.
componentName
Type:
string
The name of the component.
componentType
Type:
string
The type of the component.
componentVersion
Type:
string
The version of the component.
encrypted
Type:
boolean
Whether the component is encrypted.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
kmsKey?
Type:
IKey
(optional)
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| apply | Apply the given removal policy to this resource. |
| grant(grantee, ...actions) | Grant custom actions to the given grantee for the component. |
| grant | Grant read permissions to the given grantee for the component. |
| to | Returns a string representation of this construct. |
| static from | Import an existing component given its ARN. |
| static from | Import an existing component by providing its attributes. |
| static from | Import an existing component given its name. |
| static is | Return whether the given object is a Component. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
Parameters
- grantee
IGrantableโ The principal. - actions
stringโ The list of actions.
Returns
Grant custom actions to the given grantee for the component.
grantRead(grantee)
public grantRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ The principal.
Returns
Grant read permissions to the given grantee for the component.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromComponentArn(scope, id, componentArn)
public static fromComponentArn(scope: Construct, id: string, componentArn: string): IComponent
Parameters
- scope
Construct - id
string - componentArn
string
Returns
Import an existing component given its ARN.
static fromComponentAttributes(scope, id, attrs)
public static fromComponentAttributes(scope: Construct, id: string, attrs: ComponentAttributes): IComponent
Parameters
- scope
Construct - id
string - attrs
ComponentAttributes
Returns
Import an existing component by providing its attributes.
If the component name is provided as an attribute, it must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
static fromComponentName(scope, id, componentName)
public static fromComponentName(scope: Construct, id: string, componentName: string): IComponent
Parameters
- scope
Construct - id
string - componentName
string
Returns
Import an existing component given its name.
The provided name must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
static isComponent(x)
public static isComponent(x: any): boolean
Parameters
- x
any
Returns
boolean
Return whether the given object is a Component.

.NET
Go
Java
Python
TypeScript (