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

Helper class for referencing and uploading component data.

Extends: ComponentData
Superclass of: S3ComponentData

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

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

## Initializer

```ts
new ComponentData()
```

## Methods

- `fromAsset(scope: Construct, id: string, path: string, options?: AssetOptions): S3ComponentData` (static) — Uploads component data from a local file to S3 to use as the component data.

  **Parameters**

  - `scope` — The construct scope.
  - `id` — Identifier of the construct.
  - `path` — The local path to the component data file.
  - `options` — S3 asset upload options.

- `fromComponentDocumentJsonObject(data: ComponentDocument): ComponentData // chainable` (static) — Uses an inline JSON object as the component data, using the ComponentDocument interface.

  **Parameters**

  - `data` — An inline JSON object representing the component data.

- `fromInline(data: string): ComponentData // chainable` (static) — Uses an inline JSON/YAML string as the component data.

  **Parameters**

  - `data` — An inline JSON/YAML string representing the component data.

- `fromJsonObject(data: { [key: string]: any }): ComponentData // chainable` (static) — Uses an inline JSON object as the component data.

  **Parameters**

  - `data` — An inline JSON object representing the component data.

- `fromS3(bucket: IBucket, key: string): S3ComponentData` (static) — References component data from a pre-existing S3 object.

  **Parameters**

  - `bucket` — The S3 bucket where the component data is stored.
  - `key` — The S3 key of the component data file.

- `render(): ComponentDataConfig` — The rendered component data value, for use in CloudFormation.

  - For inline components, data is the component text
  - For S3-backed components, uri is the S3 URL
