UFO: ECS Deploy Tool

UFO provides convenient tooling to make it easier and more fun to work with ECS. UFO tries to bring a heroku-like experience to ECS.

Learn More!

Summary


The main command is ufo ship. Here's what it does:

  1. Build the Docker image and push it to repo
  2. Build the ECS Task Definition and CloudFormation template
  3. Deploy the ECS resources by launching a CloudFormation stack

Commands

ufo ship     # Deploy stack
ufo ps       # Show processes
ufo logs     # Prints logs
ufo exec     # Exec into container
ufo destroy  # Destroy stack

.ufo/resources/task_definitions/web.yml

family: <%= @family %>
networkMode: bridge
containerDefinitions:
- name: <%= @name %>
  image: <%= @image %>
  cpu: <%= @cpu %>
  memory: <%= @memory %>
  memoryReservation: <%= @memory_reservation %>
  portMappings:
  - containerPort: <%= @container_port %>
    protocol: tcp
  command: <%= @command %>
  essential: true

.ufo/vars/dev.rb

@family = family
@name = role     # IE: web worker clock
@image = docker_image
@cpu = 128
@memory = 256
@memory_reservation = 256
@container_port = dockerfile_port # parsed from Dockerfile
@environment = env_file(".env")

ufo exec

$ ufo exec
Starting session with SessionId: ecs-execute-command-099f990f7044b76b4
root@dcec6f6c7fdc:/#

About


UFO is a tool makes using AWS ECS easier. UFO allows you to write the AWS Task Definition in JSON or YAML format. It allows you to use the ERB templating language so you can use the same code to create different environments like dev and prod.

The UFO tool tries to provide a heroku-like experience. At the same time, it gives you much more control over the ECS set up.

ufo ship


$ ufo ship
Will deploy stack demo-web-dev
Building Docker Image
=> docker build -t 111111111111.dkr.ecr.us-west-2.amazonaws.com/demo:ufo-2022-03-02T20-32-33-12dc6e0 -f Dockerfile .
Docker Image built: 111111111111.dkr.ecr.us-west-2.amazonaws.com/demo:ufo-2022-03-02T20-32-33-12dc6e0
Pushing Docker Image
=> docker push 111111111111.dkr.ecr.us-west-2.amazonaws.com/demo:ufo-2022-03-02T20-32-33-12dc6e0
Task Definition built: .ufo/output/task_definition.json
Parameters built:      .ufo/output/params.json
Template built:        .ufo/output/template.yml
Creating stack demo-web-dev
Waiting for stack to complete
08:32:39PM CREATE_IN_PROGRESS AWS::CloudFormation::Stack demo-web-dev User Initiated
08:34:32PM CREATE_IN_PROGRESS AWS::ECS::Service EcsService
...
08:35:08PM CREATE_COMPLETE AWS::CloudFormation::Stack demo-web-dev
Stack success status: CREATE_COMPLETE
Time took: 2m 32s
Software shipped!
Stack: demo-web-dev
Service: demo-web-dev-EcsService-i2lBBDs31vOX
Tasks: Running: 1 Desired: 1 Min: 1 Max: 2
Application ELB: demo-we-Elb-1UV4OWTPWAN4H-1073820873.us-west-2.elb.amazonaws.com
+----------------------------------+------+-----------------+---------------+---------+
|               Task               | Name |     Release     |    Started    | Status  |
+----------------------------------+------+-----------------+---------------+---------+
| 3924c30eb7bc4c8197bf107934a4b79b | web  | demo-web-dev:39 | 1 minutes ago | RUNNING |
+----------------------------------+------+-----------------+---------------+---------+
$

Learn More