ufo ships


ufo ships [LIST_OF_SERVICES]


Builds and ships same container image to multiple ECS services.

The ufo ships command allows you to deploy the same Docker image and task definition to multiple ECS services. It is a common pattern to have the same code base running on different roles. For example, say you have an application with 3 roles:

  1. web - serves web requests.
  2. worker - processes background jobs.
  3. clock - schedules background jobs.

Instead of using the ufo ship and build and deploying the code 3 times you can instead use ufo ships. This will result in the same Docker image and same task definition being deployed to all 3 services. Example usage:

ufo ships hi-web hi-worker hi-clock

Shell expansion

Since the ECS service names are provided as a list you can shorten the command by using bash shell expansion 😁

ufo ships hi-{web,worker,clock}

If you’re new to shell expansion, run this to understand why above works just as well:

$ echo hi-{web,worker,clock}
hi-web hi-worker hi-clock

Overriding convention

As explained in detail in Conventions the task definition and service name are the same by convention. This convention also applies for each of the services being shipped in the list. The task definition and service names match for each of the services in the list. If you would like to override the convention as part of the ships command then you use a special syntax. In the special syntax the service and task definition is separated by a colon. Examples:

ufo ships hi-web-1:hi-web hi-clock-1 hi-worker-1
ufo ships hi-web-1:my-task hi-clock-1:another-task hi-worker-1:third-task

ufo ships Options

The ufo ships, ufo ship, ufo deploy command support the same options. The options are presented here again for convenience:

Option Description
--task By convention ufo uses the same name for both the ECS service and task definition. You can override this convention with this option. The conventions are covered on the Conventions page.
--target-group The ELB target group to use for the ECS service. This is respected if the ECS service is being created the first time. If the ECS service already exists, this option gets ignored.
--target-group-prompt This boolean option allows you to bypass setting the ELB target group if desired.
--wait This boolean option determines if ufo blocks and waits until the service has been deployed before continuing.
--pretty This boolean option determines ufo generates the task definitions in output in a pretty human readable format.
--stop-old-tasks This boolean option determines if ufo will call ecs stop-task on the old tasks after deployment. Sometimes old tasks hang around for a little bit with ECS this forces them along a little quicker.
--ecr-keep This integer option determines how many old docker images to keep around. Ufo will automatically delete and clean up docker images at the end of this process. The default is reasonable large at 30.
--cluster This decides what cluster to use. This can also be set in ufo/settings.yml covered in Settings. The cli option takes highest precedence.

Note: The --task option is not used with the ufo ships command.

ELB Target Group

For each service being deployed to, ufo will create the ECS service if the service does not yet exist on the cluster. The deploy process will prompt you for the ELB --target-group if you are deploying to a ‘web’ service that does not yet exist. Ufo determines that it is a web service by the name of the service. If the service has ‘web’ in the name then it is considered a web service. If it is not a web service then the --target-group option gets ignored.

The prommt can be bypassed by specifying a valid --target-group option or specifying the ---no-target-group-prompt option. ## Examples

ufo ships hi-web hi-clock hi-worker --target-group arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/hi-web/jsdlfjsdkd
ufo ships hi-web hi-clock hi-worker --no-target-group-prompt


[--task=TASK]                                        # ECS task name, to override the task name convention.
[--target-group=TARGET_GROUP]                        # ELB Target Group ARN.
[--target-group-prompt], [--no-target-group-prompt]  # Enable Target Group ARN prompt
                                                     # Default: true
[--wait], [--no-wait]                                # Wait for deployment to complete
[--pretty], [--no-pretty]                            # Pretty format the json for the task definitions
                                                     # Default: true
[--stop-old-tasks], [--no-stop-old-tasks]            # Stop old tasks after waiting for deploying to complete
[--ecr-keep=N]                                       # ECR specific cleanup of old images.  Specifies how many images to keep.  Only runs if the images are ECR images. Defaults keeps all images.
[--verbose], [--no-verbose]                          
[--mute], [--no-mute]                                
[--noop], [--no-noop]                                
[--cluster=CLUSTER]                                  # Cluster.  Overrides ufo/settings.yml.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!