Skip to content

Instantly share code, notes, and snippets.

@adamalex
Created June 22, 2017 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamalex/5aa2165c3b83332ac6bc19e2eeef51b1 to your computer and use it in GitHub Desktop.
Save adamalex/5aa2165c3b83332ac6bc19e2eeef51b1 to your computer and use it in GitHub Desktop.
amazon_ecs.cat.rb
name 'Amazon ECS Cluster'
rs_ca_ver 20160622
short_description "![logo](https://dl.dropboxusercontent.com/u/2202802/ecs-logo.png)
Creates an Amazon ECS cluster"
long_description "### Description
#### Amazon ECS
Amazon EC2 Container Service (ECS) is a highly scalable, high performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances.
#### This CloudApp
RightScale's Self-Service integration for Amazon ECS makes it easy to launch and scale a dynamically-sized ECS cluster, and exposes Docker runtime and monitoring data within RightScale's Container Manager.
---
### Parameters
#### Node Count
Enter the number of nodes for the cluster.
---
### Outputs
#### Launch Container Manager
Click this link to launch RightScale's Container Manager. Documentation for using this dashboard to view Docker runtime and monitoring data can be found at [http://docs.rightscale.com/cm/dashboard/manage/containers/index.html](http://docs.rightscale.com/cm/dashboard/manage/containers/index.html)
---
### Actions
#### Resize Cluster
This action will update the target number of cluster nodes. Although the action completes right away, please wait a few minutes for the requested changes to happen in the background.
---"
parameter "node_count" do
type "number"
label "Node Count"
category "Application"
description "Number of cluster nodes."
default 3
min_value 1
max_value 99
end
resource 'container_instances', type: 'server_array' do
name 'container_instances'
cloud 'EC2 us-west-2'
instance_type 't2.micro'
ssh_key 'default'
network 'VPC for 3tier demo'
subnets 'Subnet for 3tier demo'
security_groups 'default'
server_template find('RightLink 10.5.2 ECS', revision: 0)
state 'enabled'
array_type 'alert'
elasticity_params do {
'bounds' => {
'min_count' => $node_count,
'max_count' => $node_count
},
'pacing' => {
'resize_calm_time' => 5,
'resize_down_by' => 1,
'resize_up_by' => 1
},
'alert_specific_params' => {
'decision_threshold' => 51,
'voters_tag_predicate' => 'container_instances'
}
} end
cloud_specific_attributes do {
'iam_instance_profile' => 'ecsInstanceRole'
} end
end
output "manager_url" do
label "Launch Container Manager"
category "Application"
default_value "https://us-3.rightscale.com/acct/30601/containers"
end
operation 'op_resize_cluster' do
label 'Resize Cluster'
description 'Update the target number of cluster nodes'
definition 'resize_cluster'
end
define resize_cluster(@container_instances, $node_count) return @container_instances, $node_count do
@container_instances.update(server_array: {
"elasticity_params": {
"bounds": {
"min_count": $node_count,
"max_count": $node_count
}
}
})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment