By default, the ECS cluster UFO uses is whatever
UFO_ENV is set to. Since the default
UFO_ENV=dev, this means the ECS cluster named “dev” will be used. You can override this setting.
Ufo.configure do |config| config.ecs.cluster = ":ENV-cluster" end
Here we’re overriding the cluster name with
:ENV-cluster. The setting is a pattern that UFO expands. When
:ENV-cluster => dev-cluster
So ufo will deploy your application to the ECS cluster name “dev-cluster”.
ecs.minimum_healthy_percent can be set to control the rolling deploy percentages. Example:
Ufo.configure do |config| config.ecs.maximum_percent = 300 config.ecs.minimum_healthy_percent = 100 end
Important: You should not set the
ecs.maximum_percent to below 200 if you only have 1 container and want it to able to scale to 2. See: Debugging Deployment Configuration.
Cluster Setting as Callable Option
This is an advanced technique. For really custom control, you can also assign
config.ecs.cluster a Ruby object that implements the
.call method. Example:
class ClusterName def call(names) case names.env when "prod" "prod-cluster" when "dev", "sbx", "uat" "dev-cluster" else "qa-cluster" end end end Ufo.configure do |config| config.ecs.cluster = ClusterName # implements call method end
UFO_ENV=prod, the ECS Service uses the prod-cluster. When the
UFO_ENV is dev, sbx, or uat, the the dev-cluster. And for other
UFO_ENV values, the qa-cluster is used.
names argument is an instance of the Ufo::Names class.
The table below covers each setting. Each option is configured in
config. portion is not shown for conciseness. IE:
|ecs.cluster||:ENV||Notice that the default is a pattern. By default, the
|ecs.deployment_configuration||nil||Full control over the DeploymentConfiguration.This option is passed straight through to the CloudFormation template, so you should use CamelCase for the keys. Also when used, overrides
|ecs.desired_count.||nil||Only respected when
|ecs.maximum_percent||200||Upper limit on the number of tasks in a service that are allowed in the RUNNING or PENDING state during a deployment. This is part of DeploymentConfiguration.|
|ecs.minimum_healthy_percent||100||Lower limit on the number of tasks in a service that must remain in the RUNNING state during a deployment. This is part of DeploymentConfiguration.|
|ecs.scheduling_strategy||REPLICA||ECS Scheduling Strategy. IE: REPLICA or DAEMON|