Skip to content

AWS PowerCycler Step Functions Module

The PowerCycler Step Functions module provides an automated solution for managing AWS resource costs by scheduling the start and stop operations of EC2 instances and RDS databases. AWS Step Functions state machines are used to filter resources based on tags and execute scheduled power operations. The purpose of this module is to easily lower cost for customers.

The module offers flexible configuration options through tag-based filtering, allowing precise control over which EC2 instances and RDS databases are managed by the power cycling process. For EC2 instances, the module filters resources based on specified tags and their current running state before executing start or stop operations. AWS IAM privileges are kept as narrowed down as possible and users need to provide RDS Instances IDS to make sure we can grant us the most fine-grained privileges.

Modules

Name Source Version
dynamodb_state_table terraform-aws-modules/dynamodb-table/aws 4.4.0
ec2_powercycle ./modules/list_stop_start n/a
ecs_powercycle ./modules/list_stop_start n/a
rds_cluster_powercycle ./modules/list_stop_start n/a
rds_powercycle ./modules/list_stop_start n/a
start_stop_all ./modules/list_stop_start n/a

Inputs

Name Description Type Default Required
create Create the Step Functions bool true no
create_ec2 Create the EC2 Step Functions bool true no
create_ecs Create the ECS Step Functions bool false no
create_rds Create the RDS Step Functions bool false no
create_slack_integration Create AWS Chatbot Slack integration for notifications bool false no
ec2_allowed_tags List of tags to required to be on EC2 instances to be stopped&started
list(object({
Name = string
Values = list(string)
}))
n/a yes
ec2_schedule_expressions The schedule expression that determines when to start and stop EC2 instances
object({
stop = string
start = string
})
n/a yes
ecs_allowed_tags List of tags to required to be on ECS services to be stopped&started
list(object({
Name = string
Values = list(string)
}))
[] no
ecs_exclude_tags List of tags to exclude ECS services to be stopped&started
list(object({
Name = string
Values = list(string)
}))
[] no
ecs_schedule_expressions The schedule expression that determines when to start and stop ECS services
object({
stop = string
start = string
})
{
"start": "cron(0 6 ? * MON-FRI )",
"stop": "cron(0 20 ? * MON-FRI
)"
}
no
name_prefix The prefix for the name of the Step Functions string n/a yes
rds_allowed_instance_ids List of instance ids to filter RDS instances list(string) n/a yes
rds_schedule_expressions The schedule expression that determines when to start and stop RDS instances
object({
stop = string
start = string
})
n/a yes
slack_channel_id The Slack channel ID for AWS Chatbot notifications string "" no
slack_team_id The Slack team ID for AWS Chatbot notifications string "" no