Skip to content
v2.276.0

Experimental

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

ComponentPhaseName Enum ​

The phases of a component document.

Example ​

ts
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"']
            }
          }
        ]
      }
    ]
  })
});
python
component = imagebuilder.Component(self, "EncryptedComponent",
    platform=imagebuilder.Platform.LINUX,
    kms_key=kms.Key(self, "ComponentKey"),
    data=imagebuilder.ComponentData.from_json_object({
        "schema_version": 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\""]
                }
            }
            ]
        }
        ]
    })
)
java
Component component = Component.Builder.create(this, "EncryptedComponent")
        .platform(Platform.LINUX)
        .kmsKey(new Key(this, "ComponentKey"))
        .data(ComponentData.fromJsonObject(Map.of(
                "schemaVersion", ComponentSchemaVersion.V1_0,
                "phases", List.of(Map.of(
                        "name", ComponentPhaseName.BUILD,
                        "steps", List.of(Map.of(
                                "name", "secure-setup",
                                "action", ComponentAction.EXECUTE_BASH,
                                "inputs", Map.of(
                                        "commands", List.of("echo \"This component data is encrypted with KMS\"")))))))))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var component = new Component(this, "EncryptedComponent", new ComponentProps {
    Platform = Platform.LINUX,
    KmsKey = new Key(this, "ComponentKey"),
    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 = "secure-setup",
                Action = ComponentAction.EXECUTE_BASH,
                Inputs = new Struct {
                    Commands = new [] { "echo \"This component data is encrypted with KMS\"" }
                }
            } } }
        } } }
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
component := imagebuilder.NewComponent(this, jsii.String("EncryptedComponent"), &ComponentProps{
	Platform: imagebuilder.Platform_LINUX,
	KmsKey: kms.NewKey(this, jsii.String("ComponentKey")),
	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("secure-setup"),
						"action": imagebuilder.ComponentAction_EXECUTE_BASH,
						"inputs": map[string][]*string{
							"commands": []*string{
								jsii.String("echo \"This component data is encrypted with KMS\""),
							},
						},
					},
				},
			},
		},
	}),
})

Members ​

MemberDescription
BUILDBuild phase of the component.
CONTAINER_HOST_TESTTest phase of the component, executed directly on the instance which is used to build the container image.
TESTTest phase of the component.
VALIDATEValidate phase of the component.

Referenced by ​