Experimental
@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
ComponentSchemaVersion Enum
The schema version of the component.
Example
ts
const customComponent = 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: ['yum install -y my-application']
}
}
]
}
]
})
});
const imageRecipe = new imagebuilder.ImageRecipe(this, 'ComponentImageRecipe', {
baseImage: imagebuilder.BaseImage.fromSsmParameterName(
'/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64'
),
components: [
{
component: customComponent
}
]
});
python
custom_component = imagebuilder.Component(self, "MyComponent",
platform=imagebuilder.Platform.LINUX,
data=imagebuilder.ComponentData.from_json_object({
"schema_version": imagebuilder.ComponentSchemaVersion.V1_0,
"phases": [{
"name": imagebuilder.ComponentPhaseName.BUILD,
"steps": [{
"name": "install-app",
"action": imagebuilder.ComponentAction.EXECUTE_BASH,
"inputs": {
"commands": ["yum install -y my-application"]
}
}
]
}
]
})
)
image_recipe = imagebuilder.ImageRecipe(self, "ComponentImageRecipe",
base_image=imagebuilder.BaseImage.from_ssm_parameter_name("/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64"),
components=[imagebuilder.ComponentConfiguration(
component=custom_component
)
]
)
java
Component customComponent = Component.Builder.create(this, "MyComponent")
.platform(Platform.LINUX)
.data(ComponentData.fromJsonObject(Map.of(
"schemaVersion", ComponentSchemaVersion.V1_0,
"phases", List.of(Map.of(
"name", ComponentPhaseName.BUILD,
"steps", List.of(Map.of(
"name", "install-app",
"action", ComponentAction.EXECUTE_BASH,
"inputs", Map.of(
"commands", List.of("yum install -y my-application")))))))))
.build();
ImageRecipe imageRecipe = ImageRecipe.Builder.create(this, "ComponentImageRecipe")
.baseImage(BaseImage.fromSsmParameterName("/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64"))
.components(List.of(ComponentConfiguration.builder()
.component(customComponent)
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var customComponent = new Component(this, "MyComponent", new ComponentProps {
Platform = Platform.LINUX,
Data = ComponentData.FromJsonObject(new Dictionary<string, object> {
{ "schemaVersion", ComponentSchemaVersion.V1_0 },
{ "phases", new [] { new Dictionary<string, object> {
{ "name", ComponentPhaseName.BUILD },
{ "steps", new [] { new Struct {
Name = "install-app",
Action = ComponentAction.EXECUTE_BASH,
Inputs = new Struct {
Commands = new [] { "yum install -y my-application" }
}
} } }
} } }
})
});
var imageRecipe = new ImageRecipe(this, "ComponentImageRecipe", new ImageRecipeProps {
BaseImage = BaseImage.FromSsmParameterName("/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64"),
Components = new [] { new ComponentConfiguration {
Component = customComponent
} }
});
go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
customComponent := imagebuilder.NewComponent(this, jsii.String("MyComponent"), &ComponentProps{
Platform: imagebuilder.Platform_LINUX,
Data: imagebuilder.ComponentData_FromJsonObject(map[string]interface{}{
"schemaVersion": imagebuilder.ComponentSchemaVersion_V1_0,
"phases": []interface{}{
map[string]interface{}{
"name": imagebuilder.ComponentPhaseName_BUILD,
"steps": []map[string]interface{}{
map[string]interface{}{
"name": jsii.String("install-app"),
"action": imagebuilder.ComponentAction_EXECUTE_BASH,
"inputs": map[string][]*string{
"commands": []*string{
jsii.String("yum install -y my-application"),
},
},
},
},
},
},
}),
})
imageRecipe := imagebuilder.NewImageRecipe(this, jsii.String("ComponentImageRecipe"), &ImageRecipeProps{
BaseImage: imagebuilder.BaseImage_*FromSsmParameterName(jsii.String("/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-default-x86_64")),
Components: []ComponentConfiguration{
&ComponentConfiguration{
Component: customComponent,
},
},
})
Members
| Member | Description |
|---|---|
V1_0 | Schema version 1.0 for the component document. |
Referenced by
ComponentDocument.schemaVersionschema_versionschemaVersionSchemaVersionSchemaVersion