Auto Scaling Groups (ASG)¶
Filters¶
Standard Value Filter (see Generic Filters)
security-group
Filter for ASG’s that have a certain security group.
Schema:
{ "default": { "type": "object" }, "key": { "type": "string" }, "match-resource": { "type": "boolean" }, "op": { "$ref": "#/definitions/filters_common/comparison_operators" }, "operator": { "enum": [ "and", "or" ] }, "value": { "$ref": "#/definitions/filters_common/value" }, "value_from": { "$ref": "#/definitions/filters_common/value_from" }, "value_type": { "$ref": "#/definitions/filters_common/value_types" } }
subnet
Filter on ASG’s
Schema:
{ "default": { "type": "object" }, "key": { "type": "string" }, "match-resource": { "type": "boolean" }, "op": { "$ref": "#/definitions/filters_common/comparison_operators" }, "operator": { "enum": [ "and", "or" ] }, "value": { "$ref": "#/definitions/filters_common/value" }, "value_from": { "$ref": "#/definitions/filters_common/value_from" }, "value_type": { "$ref": "#/definitions/filters_common/value_types" } }
launch-config
Filter ASG by launch config attributes.
Schema:
{ "default": { "type": "object" }, "key": { "type": "string" }, "op": { "$ref": "#/definitions/filters_common/comparison_operators" }, "value": { "$ref": "#/definitions/filters_common/value" }, "value_from": { "$ref": "#/definitions/filters_common/value_from" }, "value_type": { "$ref": "#/definitions/filters_common/value_types" } }
valid
Filters ASG’s to find those that are structurally valid.
Schema:
{}
invalid
Filters ASG’s to find those that are structurally invalid.
Schema:
{}
not-encrypted
Check if an ASG is configured to have unencrypted volumes.
Schema:
{ "exclude_image": { "type": "boolean" } }
image-age
Filter ASG by image age (in days).
Schema:
{ "days": { "type": "number" }, "op": { "$ref": "#/definitions/filters_common/comparison_operators" } }
image
Filter by ASG image
Schema:
{ "default": { "type": "object" }, "key": { "type": "string" }, "op": { "$ref": "#/definitions/filters_common/comparison_operators" }, "value": { "$ref": "#/definitions/filters_common/value" }, "value_from": { "$ref": "#/definitions/filters_common/value_from" }, "value_type": { "$ref": "#/definitions/filters_common/value_types" } }
vpc-id
Filters ASG based on the VpcId
Schema:
{ "default": { "type": "object" }, "op": { "$ref": "#/definitions/filters_common/comparison_operators" }, "value": { "$ref": "#/definitions/filters_common/value" }, "value_from": { "$ref": "#/definitions/filters_common/value_from" }, "value_type": { "$ref": "#/definitions/filters_common/value_types" } }
progagated-tags
Filter ASG based on propagated tags
Schema:
{ "keys": { "items": { "type": "string" }, "type": "array" }, "match": { "type": "boolean" }, "propagate": { "type": "boolean" } }
capacity-delta
Filter returns ASG that have less instances than desired or required
Schema:
{}
user-data
Filter for ASG’s with launch configs containing user data matching the value given.
Schema:
{ "default": { "type": "object" }, "key": { "type": "string" }, "op": { "$ref": "#/definitions/filters_common/comparison_operators" }, "value": { "$ref": "#/definitions/filters_common/value" }, "value_from": { "$ref": "#/definitions/filters_common/value_from" }, "value_type": { "$ref": "#/definitions/filters_common/value_types" } }
Actions¶
tag-trim
Trim the number of tags to avoid hitting tag limits.
Schema:
{ "preserve": { "items": { "type": "string" }, "type": "array" }, "space": { "type": "integer" } }
resize
Resize the min/max/desired instances in an ASG.
Schema:
{ "desired-size": { "anyOf": [ { "enum": [ "current" ] }, { "minimum": 0, "type": "integer" } ] }, "desired_size": { "anyOf": [ { "enum": [ "current" ] }, { "minimum": 0, "type": "integer" } ] }, "max-size": { "minimum": 0, "type": "integer" }, "min-size": { "minimum": 0, "type": "integer" }, "restore-options-tag": { "type": "string" }, "save-options-tag": { "type": "string" } }
remove-tag
oruntag
orunmark
Removes tag from ASG.
Schema:
{ "key": { "type": "string" }, "tags": { "items": { "type": "string" }, "type": "array" } }
tag
ormark
Create or update tag on ASG.
Schema:
{ "key": { "type": "string" }, "msg": { "type": "string" }, "propagate": { "type": "boolean" }, "tag": { "type": "string" }, "tags": { "type": "object" }, "value": { "type": "string" } }
propagate-tags
Propagate tags to an ASG instances. In AWS changing an ASG tag does not propagate to instances. This action exists to do that, and can also trim older tags not present on the ASG anymore that are still present on instances.
Schema:
{ "tags": { "items": { "type": "string" }, "type": "array" }, "trim": { "type": "boolean" } }
rename-tag
Rename a tag on an AutoScaleGroup.
Schema:
{ "dest": { "required": true, "type": "string" }, "propagate": { "type": "boolean" }, "source": { "required": true, "type": "string" } }
mark-for-op
Tag ASG for an operation.
Schema:
{ "days": { "minimum": 0, "type": "number" }, "hours": { "minimum": 0, "type": "number" }, "key": { "type": "string" }, "message": { "type": "string" }, "op": { "type": "string" }, "tag": { "type": "string" } }
suspend
Multistep process to stop an ASG. Suspend processes, note load balancer in tag, detach load balancer, and then stop instances.
Schema:
{ "exclude": { "items": { "enum": [ "Launch", "Terminate", "HealthCheck", "ReplaceUnhealthy", "AZRebalance", "AlarmNotification", "ScheduledActions", "AddToLoadBalancer" ] }, "title": "ASG Processes to not suspend", "type": "array" } }
resume
Multi-step process to resume an ASG. Start any stopped EC2 instances, reattach ELB, and resume ASG processes.
Schema:
{ "delay": { "type": "number" } }
delete
Delete ASG.
Schema:
{ "force": { "type": "boolean" } }
offhour
orOffHour
Turn resources off based on a schedule.
c7n.offhours
Schema:
{ "default_tz": { "required": true, "type": "string" }, "offhour": { "maximum": 23, "minimum": 0, "required": true, "type": "integer" }, "opt-out": { "type": "boolean" }, "skip-days": { "items": { "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}", "type": "string" }, "type": "array" }, "skip-days-from": { "additionalProperties": "False", "properties": { "expr": { "oneOf": [ { "type": "integer" }, { "type": "string" } ] }, "format": { "enum": [ "csv", "json", "txt", "csv2dict" ] }, "url": { "type": "string" } }, "required": [ "url" ], "type": "object" }, "tag": { "type": "string" }, "weekends": { "type": "boolean" }, "weekends-only": { "type": "boolean" } }
onhour
oronhour
Turn resources on based on a schedule.
c7n.offhours
Schema:
{ "default_tz": { "required": true, "type": "string" }, "onhour": { "maximum": 23, "minimum": 0, "required": true, "type": "integer" }, "opt-out": { "type": "boolean" }, "skip-days": { "items": { "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}", "type": "string" }, "type": "array" }, "skip-days-from": { "additionalProperties": "False", "properties": { "expr": { "oneOf": [ { "type": "integer" }, { "type": "string" } ] }, "format": { "enum": [ "csv", "json", "txt", "csv2dict" ] }, "url": { "type": "string" } }, "required": [ "url" ], "type": "object" }, "tag": { "type": "string" }, "weekends": { "type": "boolean" }, "weekends-only": { "type": "boolean" } }
Launch Configs¶
delete
Delete a launch configuration.
Schema:
{ "force": { "type": "boolean" } }