"Deploy to Amazon ECS" action reference - Amazon CodeCatalyst

"Deploy to Amazon ECS" action reference

The following is the action definition YAML reference for the Deploy to Amazon ECS action. To learn how to use this action, see Adding the "Deploy to Amazon ECS" action.

Note

Most of the YAML properties that follow have corresponding UI elements in the visual editor. To look up a UI element, use Ctrl+F. 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. ECSDeployAction_nn: Identifier: aws/ecs-deploy@v1 DependsOn: - build-action Compute: - Type: EC2 | Lambda - Fleet: fleet-name Timeout: timeout-minutes Environment: Name: environment-name Connections: - Name: account-connection-name Role: DeployToECS Inputs: # Specify a source or an artifact, but not both. Sources: - source-name-1 Artifacts: - task-definition-artifact Configuration: region: us-east-1 cluster: ecs-cluster service: ecs-service task-definition: task-definition-path force-new-deployment: false|true codedeploy-appspec: app-spec-file-path codedeploy-application: application-name codedeploy-deployment-group: deployment-group-name codedeploy-deployment-description: deployment-description

ECSDeployAction

(Required)

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

Default: ECSDeployAction_nn.

Corresponding UI: Configuration tab/Action display name

Identifier

(ECSDeployAction/Identifier)

(Required)

Identifies the action. Do not change this property.

Default: aws/ecs-deploy@v1.

Corresponding UI: Workflow diagram/ECSDeployAction_nn/aws/ecs-deploy@v1 label

DependsOn

(ECSDeployAction/DependsOn)

(Optional)

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

For more information about the 'depends on' functionality, see Configuring actions to depend on other actions.

Corresponding UI: Inputs tab/Depends on - optional

Compute

(ECSDeployAction/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.

Corresponding UI: none

Type

(ECSDeployAction/Compute/Type)

(Required if Compute 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 About compute types.

Corresponding UI: Configuration tab/Advanced - optional/Compute type

Fleet

(ECSDeployAction/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.

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.

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

Corresponding UI: Configuration tab/Advanced - optional/Compute fleet

Timeout

(ECSDeployAction/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 8 hours. The default is 8 hours (480 minutes).

Corresponding UI: Configuration tab/Timeout - optional

Environment

(ECSDeployAction/Environment)

(Required)

Specify the CodeCatalyst environment to use with the action.

For more information about environments, see Working with environments and Creating an environment.

Corresponding UI: Configuration tab/'Environment/account/role'/Environment

Name

(ECSDeployAction/Environment/Name)

(Required)

Specify the name of an existing environment that you want to associate with the action.

Corresponding UI: Configuration tab/'Environment/account/role'/Environment

Connections

(ECSDeployAction/Environment/Connections)

(Required)

Specify the account connection to associate with the action.

For more information about account connections, see Managing AWS accounts. For information about how to associate an account connection with your environment, see Creating an environment.

Corresponding UI: Configuration tab/'Environment/account/role'/AWS account connection

Name

(ECSDeployAction/Environment/Connections/Name)

(Required)

Specify the name of the account connection.

Corresponding UI: Configuration tab/'Environment/account/role'/AWS account connection

Role

(ECSDeployAction/Environment/Connections/Role)

(Required)

Specify the name of the IAM role that the Deploy to Amazon ECS action uses to access AWS. Make sure that this role includes the following policies:

  • The following permissions policy:

    Warning

    Limit the permissions to those shown in the following policy. Using a role with broader permissions might pose a security risk.

    { "Version": "2012-10-17", "Statement": [{ "Action":[ "ecs:DescribeServices", "ecs:CreateTaskSet", "ecs:DeleteTaskSet", "ecs:ListClusters", "ecs:RegisterTaskDefinition", "ecs:UpdateServicePrimaryTaskSet", "ecs:UpdateService", "elasticloadbalancing:DescribeTargetGroups", "elasticloadbalancing:DescribeListeners", "elasticloadbalancing:ModifyListener", "elasticloadbalancing:DescribeRules", "elasticloadbalancing:ModifyRule", "lambda:InvokeFunction", "lambda:ListFunctions", "cloudwatch:DescribeAlarms", "sns:Publish", "sns:ListTopics", "s3:GetObject", "s3:GetObjectVersion", "codedeploy:CreateApplication", "codedeploy:CreateDeployment", "codedeploy:CreateDeploymentGroup", "codedeploy:GetApplication", "codedeploy:GetDeployment", "codedeploy:GetDeploymentGroup", "codedeploy:ListApplications", "codedeploy:ListDeploymentGroups", "codedeploy:ListDeployments", "codedeploy:StopDeployment", "codedeploy:GetDeploymentTarget", "codedeploy:ListDeploymentTargets", "codedeploy:GetDeploymentConfig", "codedeploy:GetApplicationRevision", "codedeploy:RegisterApplicationRevision", "codedeploy:BatchGetApplicationRevisions", "codedeploy:BatchGetDeploymentGroups", "codedeploy:BatchGetDeployments", "codedeploy:BatchGetApplications", "codedeploy:ListApplicationRevisions", "codedeploy:ListDeploymentConfigs", "codedeploy:ContinueDeployment" ], "Resource":"*", "Effect":"Allow" },{"Action":[ "iam:PassRole" ], "Effect":"Allow", "Resource":"*", "Condition":{"StringLike":{"iam:PassedToService":[ "ecs-tasks.amazonaws.com", "codedeploy.amazonaws.com" ] } } }] }
    Note

    The first time the role is used, use the following wildcard in the resource policy statement and then scope down the policy with the resource name after it is available.

    "Resource": "*"
  • The following custom trust policy:

    { "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": [ "codecatalyst-runner.amazonaws.com", "codecatalyst.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }

Make sure that this role is added to your account connection. To learn more about adding an IAM role to an account connection, see Adding IAM roles to account connections.

Note

You can specify the name of the codecatalyst-dev-admin-spaceName role here, if you'd like. For more information about this role, see Creating the codecatalyst-dev-admin-spaceName role for your account and space. Understand that the codecatalyst-dev-admin-spaceName role has very broad permissions which may pose a security risk. We recommend that you only use this role in tutorials and scenarios where security is less of a concern.

Corresponding UI: Configuration tab/'Environment/account/role'/Role

Inputs

(ECSDeployAction/Inputs)

(Optional)

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

Note

Only one input (either a source or an artifact) is allowed per Deploy to Amazon ECS action.

Corresponding UI: Inputs tab

Sources

(ECSDeployAction/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 Working with sources.

Corresponding UI: Inputs tab/Sources - optional

Artifacts - input

(ECSDeployAction/Inputs/Artifacts)

(Required if your task definition file is stored in an output artifact 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 Working with artifacts.

Corresponding UI: Configuration tab/Artifacts - optional

Configuration

(ECSDeployAction/Configuration)

(Required)

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

Corresponding UI: Configuration tab

region

(Configuration/region)

(Required)

Specify the AWS Region where your Amazon ECS cluster and service reside. For a list of Region codes, see Regional endpoints in the AWS General Reference.

Corresponding UI: Configuration tab/Region

cluster

(ECSDeployAction/Configuration/cluster)

(Required)

Specify the name of an existing Amazon ECS cluster. The Deploy to Amazon ECS action will deploy your containerized application as a task into this cluster. For more information about Amazon ECS clusters, see Clusters in the Amazon Elastic Container Service Developer Guide.

Corresponding UI: Configuration tab/Cluster

service

(ECSDeployAction/Configuration/service)

(Required)

Specify the name of an existing Amazon ECS service that will instantiate the task definition file. This service must reside under the cluster specified in the cluster field. For more information about Amazon ECS services, see Amazon ECS services in the Amazon Elastic Container Service Developer Guide.

Corresponding UI: Configuration tab/Service

task-definition

(ECSDeployAction/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 in the Amazon Elastic Container Service Developer Guide.

Corresponding UI: Configuration tab/Task definition

force-new-deployment

(ECSDeployAction/Configuration/force-new-deployment)

(Required)

If enabled, the Amazon ECS service is able to start new deployments without service definition changes. Forcing a deployment causes the service to stop all currently running tasks and launch new tasks. For more information about forcing new deployments, see Updating a service in the Amazon Elastic Container Service Developer Guide.

Default: false

Corresponding UI: Configuration tab/Force a new deployment of the service

codedeploy-appspec

(ECSDeployAction/Configuration/codedeploy-appspec)

(Required if you have configured your Amazon ECS service to use blue/green deployments, otherwise, omit)

Specify the name and path to an existing CodeDeploy application specification (AppSpec) file. This file must reside in the root of your CodeCatalyst source repository. For more information about AppSpec files, see CodeDeploy application specification (AppSpec) files in the AWS CodeDeploy User Guide.

Note

Only supply CodeDeploy information if you have configured your Amazon ECS service to perform blue/green deployments. For rolling update deployments (the default), omit CodeDeploy information. For more information about Amazon ECS deployments, see Amazon ECS deployment types in the Amazon Elastic Container Service Developer Guide.

Note

The CodeDeploy fields may be hidden in the visual editor. To get them to appear, see Why are CodeDeploy fields missing from the visual editor?.

Corresponding UI: Configuration tab/CodeDeploy AppSpec

codedeploy-application

(ECSDeployAction/Configuration/codedeploy-application)

(Required if codedeploy-appspec is included)

Specify the name of an existing CodeDeploy application. For more information about CodeDeploy applications, see Working with applications in CodeDeploy in the AWS CodeDeploy User Guide.

Corresponding UI: Configuration tab/CodeDeploy application

codedeploy-deployment-group

(ECSDeployAction/Configuration/codedeploy-deployment-group)

(Required if codedeploy-appspec is included)

Specify the name of an existing CodeDeploy deployment group. For more information about CodeDeploy deployment groups, see Working with deployment groups in CodeDeploy in the AWS CodeDeploy User Guide.

Corresponding UI: Configuration tab/CodeDeploy deployment group

codedeploy-deployment-description

(ECSDeployAction/Configuration/codedeploy-deployment-description)

(Optional)

Specify a description of the deployment that this action will create. For more information, see Working with deployments in CodeDeploy in the AWS CodeDeploy User Guide.

Corresponding UI: Configuration tab/CodeDeploy deployment description