Auto Scaling Groups (ASG)¶
Filters¶
Standard Value Filter (see Generic Filters)
security-groupFilter 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" } }
subnetFilter 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-configFilter 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" } }
validFilters ASG’s to find those that are structurally valid.
Schema:
{}invalidFilters ASG’s to find those that are structurally invalid.
Schema:
{}not-encryptedCheck if an ASG is configured to have unencrypted volumes.
Schema:
{ "exclude_image": { "type": "boolean" } }
image-ageFilter ASG by image age (in days).
Schema:
{ "days": { "type": "number" }, "op": { "$ref": "#/definitions/filters_common/comparison_operators" } }
imageFilter 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-idFilters 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-tagsFilter ASG based on propagated tags
Schema:
{ "keys": { "items": { "type": "string" }, "type": "array" }, "match": { "type": "boolean" }, "propagate": { "type": "boolean" } }
capacity-deltaFilter returns ASG that have less instances than desired or required
Schema:
{}user-dataFilter 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-trimTrim the number of tags to avoid hitting tag limits.
Schema:
{ "preserve": { "items": { "type": "string" }, "type": "array" }, "space": { "type": "integer" } }
resizeResize 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-tagoruntagorunmarkRemoves tag from ASG.
Schema:
{ "key": { "type": "string" }, "tags": { "items": { "type": "string" }, "type": "array" } }
tagormarkCreate 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-tagsPropagate 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-tagRename a tag on an AutoScaleGroup.
Schema:
{ "dest": { "required": true, "type": "string" }, "propagate": { "type": "boolean" }, "source": { "required": true, "type": "string" } }
mark-for-opTag 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" } }
suspendMultistep 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" } }
resumeMulti-step process to resume an ASG. Start any stopped EC2 instances, reattach ELB, and resume ASG processes.
Schema:
{ "delay": { "type": "number" } }
deleteDelete ASG.
Schema:
{ "force": { "type": "boolean" } }
offhourorOffHourTurn resources off based on a schedule.
c7n.offhoursSchema:
{ "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" } }
onhouroronhourTurn resources on based on a schedule.
c7n.offhoursSchema:
{ "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¶
deleteDelete a launch configuration.
Schema:
{ "force": { "type": "boolean" } }