You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -28,10 +30,78 @@ Registers an Amazon ECS task definition and deploys it to an ECS service.
28
30
wait-for-service-stability: true
29
31
```
30
32
31
-
The action can be passed a `task-definition` generated dynamically via [the `aws-actions/amazon-ecs-render-task-definition` action](https://github.com/aws-actions/amazon-ecs-render-task-definition).
32
-
33
33
See [action.yml](action.yml) for the full documentation for this action's inputs and outputs.
34
34
35
+
### Task definition file
36
+
37
+
It is highly recommended to treat the task definition "as code" by checking it into your git repository as a JSON file. Changes to any task definition attributes like container images, environment variables, CPU, and memory can be deployed with this GitHub action by editing your task definition file and pushing a new git commit.
38
+
39
+
An existing task definition can be downloaded to a JSON file with the following command. Account IDs can be removed from the file by removing the `taskDefinitionArn` attribute, and updating the `executionRoleArn` and `taskRoleArn` attribute values to contain role names instead of role ARNs.
40
+
```sh
41
+
aws ecs describe-task-definition \
42
+
--task-definition my-task-definition-family \
43
+
--query taskDefinition > task-definition.json
44
+
```
45
+
46
+
Alternatively, you can start a new task definition file from scratch with the following command. In the generated file, fill in your attribute values and remove any attributes not needed for your application.
47
+
```sh
48
+
aws ecs register-task-definition \
49
+
--generate-cli-skeleton > task-definition.json
50
+
```
51
+
52
+
If you do not wish to store your task definition as a file in your git repository, your GitHub Actions workflow can download the existing task definition.
It is highly recommended that each time your GitHub Actions workflow runs and builds a new container image for deployment, a new container image ID is generated. For example, use the commit ID as the new image's tag, instead of updating the 'latest' tag with the new image. Using a unique container image ID for each deployment allows rolling back to a previous container image.
62
+
63
+
The task definition file can be updated prior to deployment with the new container image ID using [the `aws-actions/amazon-ecs-render-task-definition` action](https://github.com/aws-actions/amazon-ecs-render-task-definition). The following example builds a new container image tagged with the commit ID, inserts the new image ID as the image for the `my-container` container in the task definition file, and then deploys the rendered task definition file to ECS:
This action relies on the [default behavior of the AWS SDK for Javascript](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html) to determine AWS credentials and region.
0 commit comments