> **Experimental**
>
> `@aws-cdk/aws-imagebuilder-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# ComponentDocument

Properties of an EC2 Image Builder Component Document.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/component.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-imagebuilder-alpha/lib/component.ts#L178)

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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" } }
                })
            } }
        } }
    })
});
```

Golang:

```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

- `constants`: { [key: string]: [ComponentConstantValue](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.ComponentConstantValue.html) } = None — The constants to define in the document.

- `description`: string = None — The description of the document.

- `name`: string = None — The name of the document.

- `parameters`: { [key: string]: [ComponentDocumentParameterDefinition](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.ComponentDocumentParameterDefinition.html) } = None — The parameters to define in the document.

- `phases`: [ComponentDocumentPhase](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.ComponentDocumentPhase.html)[] (required) — The phases which define the grouping of steps to run in the build and test workflows of the image build.

- `schemaVersion`: [ComponentSchemaVersion](/cdk/api/v2/docs/@aws-cdk_aws-imagebuilder-alpha.ComponentSchemaVersion.html) (required) — The schema version of the component.
