Skip to content
v2.277.0

Experimental

@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

ComponentDocument Struct ​

Properties of an EC2 Image Builder Component Document.

Example ​

ts
const component = new imagebuilder.Component(this, 'StructuredComponent', {
  platform: imagebuilder.Platform.LINUX,
  data: imagebuilder.ComponentData.fromComponentDocumentJsonObject({
    schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
    phases: [
      {
        name: imagebuilder.ComponentPhaseName.BUILD,
        steps: [
          {
            name: 'install-with-timeout',
            action: imagebuilder.ComponentAction.EXECUTE_BASH,
            timeout: Duration.minutes(10),
            onFailure: imagebuilder.ComponentOnFailure.CONTINUE,
            inputs: imagebuilder.ComponentStepInputs.fromObject({
              commands: ['./install-script.sh']
            })
          }
        ]
      }
    ]
  })
});
python
component = imagebuilder.Component(self, "StructuredComponent",
    platform=imagebuilder.Platform.LINUX,
    data=imagebuilder.ComponentData.from_component_document_json_object(
        schema_version=imagebuilder.ComponentSchemaVersion.V1_0,
        phases=[imagebuilder.ComponentDocumentPhase(
            name=imagebuilder.ComponentPhaseName.BUILD,
            steps=[imagebuilder.ComponentDocumentStep(
                name="install-with-timeout",
                action=imagebuilder.ComponentAction.EXECUTE_BASH,
                timeout=Duration.minutes(10),
                on_failure=imagebuilder.ComponentOnFailure.CONTINUE,
                inputs=imagebuilder.ComponentStepInputs.from_object({
                    "commands": ["./install-script.sh"]
                })
            )
            ]
        )
        ]
    )
)
java
Component component = Component.Builder.create(this, "StructuredComponent")
        .platform(Platform.LINUX)
        .data(ComponentData.fromComponentDocumentJsonObject(ComponentDocument.builder()
                .schemaVersion(ComponentSchemaVersion.V1_0)
                .phases(List.of(ComponentDocumentPhase.builder()
                        .name(ComponentPhaseName.BUILD)
                        .steps(List.of(ComponentDocumentStep.builder()
                                .name("install-with-timeout")
                                .action(ComponentAction.EXECUTE_BASH)
                                .timeout(Duration.minutes(10))
                                .onFailure(ComponentOnFailure.CONTINUE)
                                .inputs(ComponentStepInputs.fromObject(Map.of(
                                        "commands", List.of("./install-script.sh"))))
                                .build()))
                        .build()))
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var component = new Component(this, "StructuredComponent", new ComponentProps {
    Platform = Platform.LINUX,
    Data = ComponentData.FromComponentDocumentJsonObject(new ComponentDocument {
        SchemaVersion = ComponentSchemaVersion.V1_0,
        Phases = new [] { new ComponentDocumentPhase {
            Name = ComponentPhaseName.BUILD,
            Steps = new [] { new ComponentDocumentStep {
                Name = "install-with-timeout",
                Action = ComponentAction.EXECUTE_BASH,
                Timeout = Duration.Minutes(10),
                OnFailure = ComponentOnFailure.CONTINUE,
                Inputs = ComponentStepInputs.FromObject(new Dictionary<string, object> {
                    { "commands", new [] { "./install-script.sh" } }
                })
            } }
        } }
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
component := imagebuilder.NewComponent(this, jsii.String("StructuredComponent"), &ComponentProps{
	Platform: imagebuilder.Platform_LINUX,
	Data: imagebuilder.ComponentData_FromComponentDocumentJsonObject(&ComponentDocument{
		SchemaVersion: imagebuilder.ComponentSchemaVersion_V1_0,
		Phases: []ComponentDocumentPhase{
			&ComponentDocumentPhase{
				Name: imagebuilder.ComponentPhaseName_BUILD,
				Steps: []ComponentDocumentStep{
					&ComponentDocumentStep{
						Name: jsii.String("install-with-timeout"),
						Action: imagebuilder.ComponentAction_EXECUTE_BASH,
						Timeout: awscdk.Duration_Minutes(jsii.Number(10)),
						OnFailure: imagebuilder.ComponentOnFailure_CONTINUE,
						Inputs: imagebuilder.ComponentStepInputs_FromObject(map[string]interface{}{
							"commands": []interface{}{
								jsii.String("./install-script.sh"),
							},
						}),
					},
				},
			},
		},
	}),
})

Properties ​

constantsoptional{ [key: string]: ComponentConstantValue }constantsoptionaltyping.Mapping[str, ComponentConstantValue]constantsoptionalMap<String, ComponentConstantValue>ConstantsoptionalIDictionary<string, ComponentConstantValue>Constantsoptional*map[string]ComponentConstantValue = None #
The constants to define in the document.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = None #
The description of the document.
nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string = None #
The name of the document.
parametersoptional{ [key: string]: ComponentDocumentParameterDefinition }parametersoptionaltyping.Mapping[str, ComponentDocumentParameterDefinition]parametersoptionalMap<String, ComponentDocumentParameterDefinition>ParametersoptionalIDictionary<string, ComponentDocumentParameterDefinition>Parametersoptional*map[string]ComponentDocumentParameterDefinition = None #
The parameters to define in the document.
The phases which define the grouping of steps to run in the build and test workflows of the image build.
schemaVersionComponentSchemaVersionschema_versionComponentSchemaVersionschemaVersionComponentSchemaVersionSchemaVersionComponentSchemaVersionSchemaVersionComponentSchemaVersion required #
The schema version of the component.