

Amazon CodeCatalyst is no longer open to new customers. Existing customers can continue to use the service as normal. For more information, see [How to migrate from CodeCatalyst](migration.md).

# Modifying an Amazon ECS task definition
<a name="render-ecs-action"></a>

This section describes how to update the `image` field in an Amazon Elastic Container Service (Amazon ECS) [task definition file](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html#welcome-task-definitions) using a CodeCatalyst workflow. To accomplish this, you must add the **Render Amazon ECS task definition** action to your workflow. This action updates the image field in the task definition file with a Docker image name that is supplied by your workflow at runtime.

**Note**  
You can also use this action to update the task definition’s `environment` field with environment variables.

**Topics**
+ [

## When to use this action
](#render-ecs-action-when-to-use)
+ [

## How the 'Render Amazon ECS task definition' action works
](#render-ecs-action-how-it-works)
+ [

## Runtime image used by the 'Render Amazon ECS task definition' action
](#render-ecs-action-runtime)
+ [

# Example: Modify an Amazon ECS taskdef
](render-ecs-action-example-workflow.md)
+ [

# Adding the 'Render Amazon ECS task definition' action
](render-ecs-action-add.md)
+ [

# Viewing the updated task definition file
](render-ecs-action-view.md)
+ [

# 'Render Amazon ECS task definition' variables
](render-ecs-action-variables.md)
+ [

# 'Render Amazon ECS task definition' action YAML
](render-ecs-action-ref.md)

## When to use this action
<a name="render-ecs-action-when-to-use"></a>

Use this if you have a workflow that builds and tags a Docker image with dynamic content, such as a commit ID or timestamp. 

Do not use this action if your task definition file contains an image value that always stays the same. In this case, you can manually enter the name of your image into the task definition file.

## How the 'Render Amazon ECS task definition' action works
<a name="render-ecs-action-how-it-works"></a>

You must use the **Render Amazon ECS task definition** action with the **build** and **Deploy to Amazon ECS** actions in your workflow. Together, these actions work as follows:

1. The **build** action builds your Docker image and tags it with a name, a commit ID, timestamp, or other dynamic content. For example, your build action might look like this:

   ```
   MyECSWorkflow
     Actions:
       BuildAction:
         Identifier: aws/build@v1
         ...
         Configuration:
           Steps:
           # Build, tag, and push the Docker image...
             - Run: docker build -t MyDockerImage:${WorkflowSource.CommitId} .
             ...
   ```

   In the preceding code, the `docker build -t` directive indicates to build the Docker image and tag it with the commit ID at action runtime. The generated image name might look like this:

   `MyDockerImage:a37bd7e`

1. The **Render Amazon ECS task definition** action adds the dynamically generated image name, `MyDockerImage:a37bd7e`, to your task definition file, like this:

   ```
   {
       "executionRoleArn": "arn:aws:iam::account_ID:role/codecatalyst-ecs-task-execution-role",
       "containerDefinitions": [
           {
               "name": "codecatalyst-ecs-container",
               "image":  MyDockerImage:a37bd7e, 
               "essential": true,
               ...
               "portMappings": [
                   {
                       "hostPort": 80,
                       "protocol": "tcp",
                       "containerPort": 80
                   }
               ]
           }
       ],
   ...
   }
   ```

   Optionally, you can also have the **Render Amazon ECS task definition** action add environment variables to the task definition, like this:

   ```
   {
     "executionRoleArn": "arn:aws:iam::account_ID:role/codecatalyst-ecs-task-execution-role",
     "containerDefinitions": [
       {
         "name": "codecatalyst-ecs-container",
         "image":  MyDockerImage:a37bd7e,
         ...
         "environment": [
           {
             name": "ECS_LOGLEVEL",
             value": "info"
           }
         ]
       }
     ],
   ...
   }
   ```

   For more information about environment variables, see [Specifying environment variables](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html) in the *Amazon Elastic Container Service Developer Guide*.

1. The **Deploy to Amazon ECS** action registers the updated task definition file with Amazon ECS. Registering the updated task definition file deploys the new image, `MyDockerImage:a37bd7e` into Amazon ECS.

## Runtime image used by the 'Render Amazon ECS task definition' action
<a name="render-ecs-action-runtime"></a>

The **Render Amazon ECS task definition** action runs on a [November 2022 image](build-images.md#build.previous-image). For more information, see [Active images](build-images.md#build-curated-images).

# Example: Modify an Amazon ECS taskdef
<a name="render-ecs-action-example-workflow"></a>

The following is an example of a full workflow that includes the **Render Amazon ECS task definition** action, along with build and deploy actions. The workflow’s purpose is to build and deploy a Docker image into your Amazon ECS cluster. The workflow consists of the following building blocks that run sequentially:
+ A **trigger** – This trigger starts the workflow run automatically when you push a change to your source repository. For more information about triggers, see [Starting a workflow run automatically using triggers](workflows-add-trigger.md). 
+ A **build** action (`BuildDocker`) – On trigger, the action builds the Docker image using the Dockerfile, tags it with a commit ID, and pushes the image to Amazon ECR. For more information about the build action, see [Building with workflows](build-workflow-actions.md).
+ A **Render Amazon ECS task definition** action (`RenderTaskDef`) – On completion of the build action, this action updates an existing `taskdef.json` located in the root of your source repository with an `image` field value that includes the correct commit ID. It saves the updated file with a new file name (`task-definition-random-string.json`) and then creates an output artifact that contains this file. The render action also generates a variable called `task-definition` and sets it to the name of the new task definition file. The artifact and variable will be used the deploy action, which is next.
+ A **Deploy to Amazon ECS** action (`DeployToECS`) – On completion of the **Render Amazon ECS task definition** action, the **Deploy to Amazon ECS** action looks for the output artifact generated by the render action (`TaskDefArtifact`), finds the `task-definition-random-string.json` file inside of it, and registers it with your Amazon ECS service. The Amazon ECS service then follows the instructions in the `task-definition-random-string.json` file to run Amazon ECS tasks—and associated Docker image containers—inside your Amazon ECS cluster. 

```
Name: codecatalyst-ecs-workflow
SchemaVersion: 1.0

Triggers:
  - Type: PUSH
    Branches:
      - main
Actions:
  BuildDocker:
    Identifier: aws/build@v1
    Environment:
      Name: codecatalyst-ecs-environment
      Connections:
        - Name: codecatalyst-account-connection
          Role: codecatalyst-ecs-build-role
    Inputs:
      Variables:
        - Name: REPOSITORY_URI
          Value: 111122223333.dkr.ecr.us-east-2.amazonaws.com/codecatalyst-ecs-image-repo
        - Name: IMAGE_TAG
          Value: ${WorkflowSource.CommitId}
    Configuration:
      Steps:
        #pre_build:
        - Run: echo Logging in to Amazon ECR...
        - Run: aws --version
        - Run: aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 111122223333.dkr.ecr.us-east-2.amazonaws.com
        #build:
        - Run: echo Build started on `date`
        - Run: echo Building the Docker image...
        - Run: docker build -t $REPOSITORY_URI:latest .
        - Run: docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
        #post_build:
        - Run: echo Build completed on `date`
        - Run: echo Pushing the Docker images...
        - Run: docker push $REPOSITORY_URI:latest
        - Run: docker push $REPOSITORY_URI:$IMAGE_TAG
        
  RenderTaskDef:
    DependsOn: 
      - BuildDocker
    Identifier: aws/ecs-render-task-definition@v1
    Inputs:
      Variables:
        - Name: REPOSITORY_URI
          Value: 111122223333.dkr.ecr.us-east-2.amazonaws.com/codecatalyst-ecs-image-repo
        - Name: IMAGE_TAG
          Value: ${WorkflowSource.CommitId}
    Configuration:      
      task-definition: taskdef.json
      container-definition-name: codecatalyst-ecs-container
      image: $REPOSITORY_URI:$IMAGE_TAG 
    # The output artifact contains the updated task definition file. 
    # The new file is prefixed with 'task-definition'.
    # The output variable is set to the name of the updated task definition file. 
    Outputs:
      Artifacts:
        - Name: TaskDefArtifact
          Files: 
            - "task-definition*"
      Variables:
        - task-definition
        
  DeployToECS:
    Identifier: aws/ecs-deploy@v1
    Environment:
      Name: codecatalyst-ecs-environment
      Connections:
        - Name: codecatalyst-account-connection
          Role: codecatalyst-ecs-deploy-role
    #Input artifact contains the updated task definition file.
    Inputs:
      Sources: []
      Artifacts:
        - TaskDefArtifact
    Configuration:
      region: us-east-2
      cluster: codecatalyst-ecs-cluster
      service: codecatalyst-ecs-service
      task-definition: ${RenderTaskDef.task-definition}
```

# Adding the 'Render Amazon ECS task definition' action
<a name="render-ecs-action-add"></a>

 Use the following instructions to add the **Render Amazon ECS task definition** action to your workflow. 

**Prerequisite**  
Before you begin, make sure you have a workflow that includes a build action that dynamically generates a Docker image. See the preceding [example workflow](render-ecs-action-example-workflow.md) for details.

------
#### [ Visual ]

**To add the 'Render Amazon ECS task definition' action using the visual editor**

1. Open the CodeCatalyst console at [https://codecatalyst.aws/](https://codecatalyst.aws/).

1. Choose your project.

1. In the navigation pane, choose **CI/CD**, and then choose **Workflows**.

1. Choose the name of your workflow. You can filter by the source repository or branch name where the workflow is defined, or filter by workflow name or status.

1. Choose **Edit**.

1. Choose **Visual**.

1. At the top-left, choose **\$1 Actions** to open the action catalog.

1. From the drop-down list, choose **Amazon CodeCatalyst**.

1. Search for the **Render Amazon ECS task definition** action, and do one of the following:
   + Choose the plus sign (**\$1**) to add the action to the workflow diagram and open its configuration pane.

     Or
   + Choose **Render Amazon ECS task definition**. The action details dialog box appears. On this dialog box:
     + (Optional) Choose **View source** to [view the action's source code](workflows-view-source.md#workflows-view-source.title).
     + Choose **Add to workflow** to add the action to the workflow diagram and open its configuration pane.

1. In the **Inputs** and **Configuration** tabs, complete the fields according to your needs. For a description of each field, see the ['Render Amazon ECS task definition' action YAML](render-ecs-action-ref.md). This reference provides detailed information about each field (and corresponding YAML property value) as it appears in both the YAML and visual editors.

1. (Optional) Choose **Validate** to validate the workflow's YAML code before committing.

1. Choose **Commit**, enter a commit message, and choose **Commit** again.

------
#### [ YAML ]

**To add the 'Render Amazon ECS task definition' action using the YAML editor**

1. Open the CodeCatalyst console at [https://codecatalyst.aws/](https://codecatalyst.aws/).

1. Choose your project.

1. In the navigation pane, choose **CI/CD**, and then choose **Workflows**.

1. Choose the name of your workflow. You can filter by the source repository or branch name where the workflow is defined, or filter by workflow name or status.

1. Choose **Edit**.

1. Choose **YAML**.

1. At the top-left, choose **\$1 Actions** to open the action catalog.

1. From the drop-down list, choose **Amazon CodeCatalyst**.

1. Search for the **Render Amazon ECS task definition** action, and do one of the following:
   + Choose the plus sign (**\$1**) to add the action to the workflow diagram and open its configuration pane.

     Or
   + Choose **Render Amazon ECS task definition**. The action details dialog box appears. On this dialog box:
     + (Optional) Choose **View source** to [view the action's source code](workflows-view-source.md#workflows-view-source.title).
     + Choose **Add to workflow** to add the action to the workflow diagram and open its configuration pane.

1. Modify the properties in the YAML code according to your needs. An explanation of each available property is provided in the ['Render Amazon ECS task definition' action YAML](render-ecs-action-ref.md).

1. (Optional) Choose **Validate** to validate the workflow's YAML code before committing.

1. Choose **Commit**, enter a commit message, and choose **Commit** again.

------

**Next steps**

After adding the render action, add the **Deploy to Amazon ECS** action to your workflow following the instructions in [Deploying to Amazon ECS with a workflow](deploy-action-ecs.md). While adding the deploy action, do the following:

1. In the **Inputs** tab of the deploy action, in **Artifacts - optional**, select the artifact that was generated by the render action. It contains the updated task definition file.

   For more information about artifacts, see [Sharing artifacts and files between actions](workflows-working-artifacts.md).

1. In the **Configuration** tab of the deploy action, in the **Task definition** field, specify the following action variable: `${action-name.task-definition}` where *action-name* is the name of your render action, for example, `RenderTaskDef`. The render action sets this variable to the new name of the task definition file.

   For more information about variables, see [Using variables in workflows](workflows-working-with-variables.md).

   For more information about how to configure the deploy action, see the preceding [example workflow](render-ecs-action-example-workflow.md).

# Viewing the updated task definition file
<a name="render-ecs-action-view"></a>

You can view the name and contents of the updated task definition file.

**To view the name of the updated task definition file, after the **Render Amazon ECS task definition** action has processed it.**

1. Find the run that includes a completed render action:

   1. Open the CodeCatalyst console at [https://codecatalyst.aws/](https://codecatalyst.aws/).

   1. Choose your project.

   1. In the navigation pane, choose **CI/CD**, and then choose **Workflows**.

   1. Choose the name of your workflow. You can filter by the source repository or branch name where the workflow is defined, or filter by workflow name or status.

   1. Choose a run that includes the completed render action.

1. In the workflow diagram, choose the render action.

1. Choose **Outputs**.

1. Choose **Variables**.

1. The task definition file name is displayed. It looks similar to `task-definition--259-0a2r7gxlTF5X-.json`.

**To view the contents of the updated task definition file**

1. Find the run that includes a completed render action:

   1. Open the CodeCatalyst console at [https://codecatalyst.aws/](https://codecatalyst.aws/).

   1. Choose your project.

   1. In the navigation pane, choose **CI/CD**, and then choose **Workflows**.

   1. Choose the name of your workflow. You can filter by the source repository or branch name where the workflow is defined, or filter by workflow name or status.

   1. Choose a run that includes the completed render action.

1. In the workflow run, at the top, next to **Visual** and **YAML**, choose **Workflow outputs**.

1. In the **Artifacts** section, choose **Download** next to the artifact that contains the updated task definition file. This artifact will have a **Produced by** column set to the name of your render action.

1. Open the .zip file to view the task definition .json file.

# 'Render Amazon ECS task definition' variables
<a name="render-ecs-action-variables"></a>

The **Render Amazon ECS task definition** action produces and sets the following variables at run time. These are known as *predefined variables*.

For information about referencing these variables in a workflow, see [Using predefined variables](workflows-using-predefined-variables.md).


| Key | Value | 
| --- | --- | 
|  task-definition  |  The name given to the task definition file that was updated by the **Render Amazon ECS task definition** action. The name follows the format `task-definition-random-string.json`. Example: `task-definition--259-0a2r7gxlTF5Xr.json`  | 

# 'Render Amazon ECS task definition' action YAML
<a name="render-ecs-action-ref"></a>

The following is the YAML definition of the **Render Amazon ECS task definition** action. To learn how to use this action, see [Modifying an Amazon ECS task definition](render-ecs-action.md).

This action definition exists as a section within a broader workflow definition file. For more information about this file, see [Workflow YAML definition](workflow-reference.md).

**Note**  
Most of the YAML properties that follow have corresponding UI elements in the visual editor. To look up a UI element, use **Ctrl\$1F**. The element will be listed with its associated YAML property.

```
# The workflow definition starts here.
# See Top-level properties for details.
        
Name: MyWorkflow
SchemaVersion: 1.0 
Actions:

# The action definition starts here.   
  ECSRenderTaskDefinition\$1nn: 
    Identifier: aws/ecs-render-task-definition@v1
    DependsOn:
      - build-action
    Compute:  
      Type: EC2 | Lambda
      Fleet: fleet-name
    Timeout: timeout-minutes
    Inputs:
      # Specify a source or an artifact, but not both.
      Sources:
        - source-name-1
      Artifacts:
        - task-definition-artifact
      Variables:
        - Name: variable-name-1
          Value: variable-value-1
        - Name: variable-name-2
          Value: variable-value-2
    Configuration 
      task-definition: task-definition-path
      container-definition-name: container-definition-name
      image: docker-image-name
      environment-variables:
        - variable-name-1=variable-value-1
        - variable-name-2=variable-value-2
    Outputs:
      Artifacts:
        - Name: TaskDefArtifact
          Files: "task-definition*"
      Variables:
        - task-definition
```

## ECSRenderTaskDefinition
<a name="render.ecs.name"></a>

(Required)

Specify the name of the action. All action names must be unique within the workflow. Action names are limited to alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (\$1). Spaces are not allowed. You cannot use quotation marks to enable special characters and spaces in action names.

Default: `ECSRenderTaskDefinition_nn`.

Corresponding UI: Configuration tab/**Action name**

## Identifier
<a name="render.ecs.identifier"></a>

(*ECSRenderTaskDefinition*/**Identifier**)

(Required)

Identifies the action. Do not change this property unless you want to change the version. For more information, see [Specifying the action version to use](workflows-action-versions.md).

Default: `aws/ecs-render-task-definition@v1`.

Corresponding UI: Workflow diagram/ECSRenderTaskDefinition\$1nn/**aws/ecs-render-task-definition@v1** label

## DependsOn
<a name="render.ecs.dependson"></a>

(*ECSRenderTaskDefinition*/**DependsOn**)

(Optional)

Specify an action, action group, or gate that must run successfully in order for this action to run.

For more information about the 'depends on' functionality, see [Sequencing actions](workflows-depends-on.md).

Corresponding UI: Inputs tab/**Depends on - optional**

## Compute
<a name="render.ecs.computename"></a>

(*ECSRenderTaskDefinition*/**Compute**)

(Optional)

The computing engine used to run your workflow actions. You can specify compute either at the workflow level or at the action level, but not both. When specified at the workflow level, the compute configuration applies to all actions defined in the workflow. At the workflow level, you can also run multiple actions on the same instance. For more information, see [Sharing compute across actions](compute-sharing.md).

Corresponding UI: *none*

## Type
<a name="render.ecs.computetype"></a>

(*ECSRenderTaskDefinition*/Compute/**Type**)

(Required if [Compute](#render.ecs.computename) is included)

The type of compute engine. You can use one of the following values:
+ **EC2** (visual editor) or `EC2` (YAML editor)

  Optimized for flexibility during action runs.
+ **Lambda** (visual editor) or `Lambda` (YAML editor)

  Optimized action start-up speeds.

For more information about compute types, see [Compute types](workflows-working-compute.md#compute.types).

Corresponding UI: Configuration tab/**Compute type**

## Fleet
<a name="render.ecs.computefleet"></a>

(*ECSRenderTaskDefinition*/Compute/**Fleet**)

(Optional)

Specify the machine or fleet that will run your workflow or workflow actions. With on-demand fleets, when an action starts, the workflow provisions the resources it needs, and the machines are destroyed when the action finishes. Examples of on-demand fleets: `Linux.x86-64.Large`, `Linux.x86-64.XLarge`. For more information about on-demand fleets, see [On-demand fleet properties](workflows-working-compute.md#compute.on-demand).

With provisioned fleets, you configure a set of dedicated machines to run your workflow actions. These machines remain idle, ready to process actions immediately. For more information about provisioned fleets, see [Provisioned fleet properties](workflows-working-compute.md#compute.provisioned-fleets).

If `Fleet` is omitted, the default is `Linux.x86-64.Large`.

Corresponding UI: Configuration tab/**Compute fleet**

## Timeout
<a name="render.ecs.timeout"></a>

(*ECSRenderTaskDefinition*/**Timeout**)

(Optional)

Specify the amount of time in minutes (YAML editor), or hours and minutes (visual editor), that the action can run before CodeCatalyst ends the action. The minimum is 5 minutes and the maximum is described in [Quotas for workflows in CodeCatalyst](workflows-quotas.md). The default timeout is the same as the maximum timeout.

Corresponding UI: Configuration tab/**Timeout - optional **

## Inputs
<a name="render.ecs.inputs"></a>

(*ECSRenderTaskDefinition*/**Inputs**)

(Optional)

The `Inputs` section defines the data that the `ECSRenderTaskDefinition` needs during a workflow run.

**Note**  
Only one input (either a source or an artifact) is allowed per **Render Amazon ECS task definition** action. Variables do not count towards this total.

Corresponding UI: **Inputs** tab

## Sources
<a name="render.ecs.inputs.sources"></a>

(*ECSRenderTaskDefinition*/Inputs/**Sources**)

(Required if your task definition file is stored in a source repository)

If your task definition file is stored in a source repository, specify the label of that source repository. Currently, the only supported label is `WorkflowSource`.

If your task definition file is not contained within a source repository, it must reside in an artifact generated by another action.

For more information about sources, see [Connecting source repositories to workflows](workflows-sources.md).

Corresponding UI: Inputs tab/**Sources - optional**

## Artifacts - input
<a name="render.ecs.inputs.artifacts"></a>

(*ECSRenderTaskDefinition*/Inputs/**Artifacts**)

(Required if your task definition file is stored in an [output artifact](workflows-working-artifacts-output.md) from a previous action)

If the task definition file that you want to deploy is contained in an artifact generated by a previous action, specify that artifact here. If your task definition file is not contained within an artifact, it must reside in your source repository.

For more information about artifacts, including examples, see [Sharing artifacts and files between actions](workflows-working-artifacts.md).

Corresponding UI: Configuration tab/**Artifacts - optional**

## Variables - input
<a name="render.ecs.inputs.variables"></a>

(*ECSRenderTaskDefinition*/Inputs/**Variables**)

(Required)

Specify a sequence of name/value pairs that define the input variables that you want to make available to the action. Variable names are limited to alphanumeric characters (a-z, A-Z, 0-9), hyphens (-), and underscores (\$1). Spaces are not allowed. You cannot use quotation marks to enable special characters and spaces in variable names.

For more information about variables, including examples, see [Using variables in workflows](workflows-working-with-variables.md).

Corresponding UI: Inputs tab/**Variables - optional**

## Configuration
<a name="render.ecs.configuration"></a>

(*ECSRenderTaskDefinition*/**Configuration**)

(Required)

A section where you can define the configuration properties of the action.

Corresponding UI: **Configuration** tab

## task-definition
<a name="render.ecs.task.definition"></a>

(*ECSRenderTaskDefinition*/Configuration/**task-definition**)

(Required)

Specify the path to an existing task definition file. If the file resides in your source repository, the path is relative to the source repository root folder. If your file resides in an artifact from a previous workflow action, the path is relative to the artifact root folder. For more information about task definition files, see [Task definitions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html#welcome-task-definitions) in the *Amazon Elastic Container Service Developer Guide*.

Corresponding UI: Configuration tab/**Task definition**

## container-definition-name
<a name="render.ecs.container.name"></a>

(*ECSRenderTaskDefinition*/Configuration/**container-definition-name**)

(Required)

Specify the name of the container where your Docker image will run. You can find this name in the `containerDefinitions`, `name` field in your task definition file. For more information, see [Name](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_name) in the *Amazon Elastic Container Service Developer Guide*.

Corresponding UI: Configuration tab/**Container name**

## image
<a name="render.ecs.image"></a>

(*ECSRenderTaskDefinition*/Configuration/**image**)

(Required)

Specify the name of the Docker image that you want the **Render Amazon ECS task definition** action to add to your task definition file. The action adds this name to the `containerDefinitions`, `image` field in your task definition file. If a value already exists in the `image` field, then the action overwrites it. You can include variables in the image name.

Examples:

If you specify `MyDockerImage:${WorkflowSource.CommitId}`, the action adds `MyDockerImage:commit-id` to the task definition file, where *commit-id* is a commit ID generated at runtime by the workflow.

If you specify `my-ecr-repo/image-repo:$(date +%m-%d-%y-%H-%m-%s)`, the action adds *my-ecr-repo*/image-repo:*date \$1%m-%d-%y-%H-%m-%s* to the task definition file, where *my-ecr-repo* is the URI of an Amazon Elastic Container Registry (ECR) and *date \$1%m-%d-%y-%H-%m-%s* is a timestamp in the format `month-day-year-hour-minute-second` generated at runtime by the workflow.

For more information about the `image` field, see [Image](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definition_image) in the *Amazon Elastic Container Service Developer Guide*. For more information about variables, see [Using variables in workflows](workflows-working-with-variables.md).

Corresponding UI: Configuration tab/**Image name**

## environment-variables
<a name="render.ecs.environment.variables"></a>

(*ECSRenderTaskDefinition*/Configuration/**environment-variables**)

(Required)

Specify environment variables that you want the **Render Amazon ECS task definition** action to add to your task definition file. The action adds the variables to the `containerDefinitions`, `environment` field in your task definition file. If variables already exist in the file, the action overwrites the values of existing variables and adds any new variables. For more information about Amazon ECS environment variables, see [Specifying environment variables](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html) in the *Amazon Elastic Container Service Developer Guide*.

Corresponding UI: Configuration tab/**Environment variables - optional**

## Outputs
<a name="render.ecs.outputs"></a>

(*ECSRenderTaskDefinition*/**Outputs**)

(Required)

Defines the data that is output by the action during a workflow run.

Corresponding UI: **Outputs** tab

## Artifacts
<a name="render.ecs.outputs.artifacts"></a>

(*ECSRenderTaskDefinition*/Outputs/**Artifacts**)

(Required)

Specify the artifacts generated by the action. You can reference these artifacts as input in other actions.

For more information about artifacts, including examples, see [Sharing artifacts and files between actions](workflows-working-artifacts.md).

Corresponding UI: Outputs tab/**Artifacts**

## Name
<a name="render.ecs.outputs.artifacts.name"></a>

(*ECSRenderTaskDefinition*/Outputs/Artifacts/**Name**)

(Required)

Specify the name of the artifact that will contain the updated task definition file. The default value is `MyTaskDefinitionArtifact`. You must then specify this artifact as input into the **Deploy to Amazon ECS** action. To understand how to add this artifact as input to the **Deploy to Amazon ECS** action, see [Example: Modify an Amazon ECS taskdef](render-ecs-action-example-workflow.md).

Corresponding UI: Outputs tab/Artifacts/**Name**

## Files
<a name="render.ecs.outputs.artifacts.files"></a>

(*ECSRenderTaskDefinition*/Outputs/Artifacts/**Files**)

(Required)

Specify the files to include in the artifact. You must specify `task-definition-*` so that the updated task definition file, which starts with `task-definition-`, will be included.

Corresponding UI: Outputs tab/Artifacts/**Files**

## Variables
<a name="render.ecs.outputs.variables"></a>

(*ECSRenderTaskDefinition*/Outputs/**Variables**)

(Required)

Specify the name of a variable to be set by the render action. The render action will set this variable's value to the name of the updated task definition file (for example, `task-definition-random-string.json`). You must then specify this variable in the **Deploy to Amazon ECS** action's **Task definition** (visual editor) or `task-definition` (yaml editor) property. To understand how to add this variable to the **Deploy to Amazon ECS** action, see [Example: Modify an Amazon ECS taskdef](render-ecs-action-example-workflow.md) .

Default: `task-definition`

Corresponding UI: Outputs tab/Variables/**Name** field