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

The action for a step within the 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#L391)

## Example

TypeScript:

```ts

const component = new imagebuilder.Component(this, 'JsonComponent', {
  platform: imagebuilder.Platform.LINUX,
  data: imagebuilder.ComponentData.fromJsonObject({
    schemaVersion: imagebuilder.ComponentSchemaVersion.V1_0,
    phases: [
      {
        name: imagebuilder.ComponentPhaseName.BUILD,
        steps: [
          {
            name: 'configure-app',
            action: imagebuilder.ComponentAction.CREATE_FILE,
            inputs: {
              path: '/etc/myapp/config.json',
              content: '{"env": "production"}'
            }
          }
        ]
      }
    ]
  })
});
```

Python:

```python
component = imagebuilder.Component(self, "JsonComponent",
    platform=imagebuilder.Platform.LINUX,
    data=imagebuilder.ComponentData.from_json_object({
        "schema_version": imagebuilder.ComponentSchemaVersion.V1_0,
        "phases": [{
            "name": imagebuilder.ComponentPhaseName.BUILD,
            "steps": [{
                "name": "configure-app",
                "action": imagebuilder.ComponentAction.CREATE_FILE,
                "inputs": {
                    "path": "/etc/myapp/config.json",
                    "content": "{\"env\": \"production\"}"
                }
            }
            ]
        }
        ]
    })
)
```

Java:

```java
Component component = Component.Builder.create(this, "JsonComponent")
        .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", "configure-app",
                                "action", ComponentAction.CREATE_FILE,
                                "inputs", Map.of(
                                        "path", "/etc/myapp/config.json",
                                        "content", "{\"env\": \"production\"}"))))))))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
var component = new Component(this, "JsonComponent", 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 = "configure-app",
                Action = ComponentAction.CREATE_FILE,
                Inputs = new Struct {
                    Path = "/etc/myapp/config.json",
                    Content = "{\"env\": \"production\"}"
                }
            } } }
        } } }
    })
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
component := imagebuilder.NewComponent(this, jsii.String("JsonComponent"), &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("configure-app"),
						"action": imagebuilder.ComponentAction_CREATE_FILE,
						"inputs": map[string]*string{
							"path": jsii.String("/etc/myapp/config.json"),
							"content": jsii.String("{\"env\": \"production\"}"),
						},
					},
				},
			},
		},
	}),
})
```

## Members

| Member | Description |
| --- | --- |
| `APPEND_FILE` | The AppendFile action adds the provided content to the pre-existing content of a file. |
| `ASSERT` | The Assert action performs value with comparison/logic operators, and succeeds/fails the step based on the outcome of the assertion. |
| `COPY_FILE` | The CopyFile action copies files from a source file to a destination. |
| `COPY_FOLDER` | The CopyFolder action copies folders from a source to a destination. |
| `CREATE_FILE` | The CreateFile action creates a file in the provided location. |
| `CREATE_FOLDER` | The CreateFolder action creates a folder in the provided location. |
| `CREATE_SYMLINK` | The CreateSymlink action creates symbolic links from a given path to a target. |
| `DELETE_FILE` | The DeleteFile action deletes file(s) in the provided location. |
| `DELETE_FOLDER` | The DeleteFolder action deletes folders in the provided location. |
| `EXECUTE_BASH` | The ExecuteBash action runs bash scripts with inline bash commands. |
| `EXECUTE_BINARY` | The ExecuteBinary action runs a provided binary executable. |
| `EXECUTE_DOCUMENT` | The ExecuteDocument action allows running other component documents from within a given component. |
| `EXECUTE_POWERSHELL` | The ExecutePowershell action runs PowerShell scripts with inline PowerShell commands. |
| `INSTALL_MSI` | The InstallMSI action runs a Windows application with the provided MSI file. |
| `LIST_FILES` | The ListFiles action lists files in the provided folder. |
| `MOVE_FILE` | The MoveFile action moves files from a source to a destination. |
| `MOVE_FOLDER` | The MoveFolder action moves folders from a source to a destination. |
| `READ_FILE` | The ReadFile action reads the content of a text file. |
| `REBOOT` | The Reboot action reboots the instance. |
| `SET_FILE_ENCODING` | The SetFileEncoding action modifies the encoding property of an existing file. |
| `SET_FILE_OWNER` | The SetFileOwner action modifies the owner and group ownership properties of an existing file. |
| `SET_FOLDER_OWNER` | The SetFolderOwner action recursively modifies the owner and group ownership properties of an existing folder. |
| `SET_FILE_PERMISSIONS` | The SetFilePermissions action modifies the permission of an existing file. |
| `SET_FOLDER_PERMISSIONS` | The SetFolderPermissions action recursively modifies the permissions of an existing folder and all of its subfiles and subfolders. |
| `SET_REGISTRY` | The SetRegistry action sets the value for the specified Windows registry key. |
| `S3_DOWNLOAD` | The S3Download action downloads an Amazon S3 object/folder to a local destination. |
| `S3_UPLOAD` | The S3Upload action uploads a file or folder to an Amazon S3 location. |
| `UNINSTALL_MSI` | The UninstallMSI action removes a Windows application using an MSI file. |
| `UPDATE_OS` | The UpdateOS action installs OS updates. |
| `WEB_DOWNLOAD` | The WebDownload action downloads files from a URL to a local destination. |

## Referenced by

- [`ComponentDocumentStep`](/v2/docs/@aws-cdk_aws-imagebuilder-alpha.ComponentDocumentStep).action
