### Defining AWS Service Scheduler Start and Stop Times Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Shows examples of the `start-time` and `stop-time` AWS tags, which are essential for defining the daily scheduling window in `HH:MM` 24-hour format. These tags specify when a resource should be started and stopped automatically. ```AWS Tags start-time = "08:00" stop-time = "18:00" ``` -------------------------------- ### Showing AWS Service Scheduler Tag Structure Examples Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Illustrates the basic structure of AWS tags used by the service scheduler, including the prefix, action, and optional iterator components. These examples show how different scheduling parameters are specified using the tag key format. ```AWS Tags scheduler:start-time scheduler:stop-time scheduler:active-days scheduler:active-days:1 scheduler:stop-time:1 ``` -------------------------------- ### Shutdown AWS Resources Daily 7:30pm (JSON Tag Config) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/examples.md Configures a resource to be shut down every day at 7:30 PM. This is often used for manually started instances that should be stopped automatically overnight. Requires the scheduler tool to be enabled and monitoring the resource. ```JSON { "scheduler:enabled" = "true" "scheduler:stop-time" = "19:30" } ``` -------------------------------- ### Schedule AWS Resources Mon-Fri 8am-6pm (JSON Tag Config) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/examples.md Configures a resource to be active every weekday (Monday to Friday) from 8:00 AM to 6:00 PM using `scheduler:` tags. Requires the scheduler tool to be enabled and monitoring the resource. ```JSON { "scheduler:enabled" = "true" "scheduler:active-days" = "MON-FRI" "scheduler:start-time" = "08:00" "scheduler:stop-time" = "18:00" } ``` -------------------------------- ### Setting AWS Service Scheduler Node Type for Resizing Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Shows examples of `scheduler:start-node-type` and `scheduler:stop-node-type` AWS tags used for services that support resizing rather than stopping/starting, such as ElastiCache. These tags specify the desired node type for the start and stop actions. ```AWS Tags scheduler:start-node-type = "cache.t4g.medium" scheduler:stop-node-type = "cache.t4g.micro" ``` -------------------------------- ### Deploying AWS Service Scheduler using Terraform Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/index.md This Terraform module block demonstrates how to deploy the AWS Service Scheduler. It requires specifying the source and version of the module, a list of `enabled_services`, a `default_timezone` for scheduling logic, an `app_name` for resource naming, and the `execution_interval` in minutes for the state machine. This setup configures the scheduler to manage resources across the specified AWS services. ```Terraform module "service_scheduler" { source = "phergoualch/service-scheduler/aws" version = ">= 2.0.0" enabled_services = ["ec2", "asg", "ecs", "rds", "documentdb", "lambda", "apprunner", "aurora", "elasticache", "cloudwatch"] #(1)! default_timezone = "Europe/Paris" #(2)! app_name = "service-scheduler" #(3)! execution_interval = 6 #(4)! } ``` -------------------------------- ### Triggering Service Scheduler Step Function via AWS CLI (Basic) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/manual-execution.md This command executes the specified AWS Step Function state machine (`service-scheduler-start`) using the AWS CLI. It provides a basic input JSON specifying a single selector that targets all services and resources (`tags: all`, `services: all`) with no delay (`delay: 0`). This requires the AWS CLI installed and configured with appropriate permissions. ```bash aws stepfunctions start-execution \ --state-machine-arn arn:aws:states:::stateMachine:service-scheduler-start \ --input "{\"selectors\": [{\"services\":\"all\",\"tags\":\"all\",\"delay\":0}]}" ``` -------------------------------- ### Adding Scheduler Tags to ASG (HCL) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/supported-services.md This HCL snippet demonstrates how to add dynamic tags to an AWS Autoscaling Group resource. It iterates through a variable `var.scheduler_tags` and sets `key`, `value`, and `propagate_at_launch=false` for each tag, which is required to make the ASG compatible with the service scheduler. ```HCL dynamic "tag" { for_each = var.scheduler_tags content { key = tag.key value = tag.value propagate_at_launch = false } } ``` -------------------------------- ### Schedule AWS Resources Weekday/Weekend Diff Times (JSON Tag Config) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/examples.md Configures a resource with two different schedules: one for weekdays (Monday-Friday, 8:00 AM to 6:00 PM) and another for weekends (Saturday-Sunday, 10:00 AM to 4:00 PM). Uses index `:1` for the second schedule. Requires the scheduler tool to be enabled, monitoring the resource, and supporting multiple schedules. ```JSON { "scheduler:enabled" = "true" "scheduler:start-time" = "08:00" "scheduler:stop-time" = "18:00" "scheduler:active-days" = "MON-FRI" "scheduler:start-time:1" = "10:00" "scheduler:stop-time:1" = "16:00" "scheduler:active-days:1" = "SAT-SUN" } ``` -------------------------------- ### Defining AWS Service Scheduler Start/Stop Active Days Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Shows how to use the `start-active-days` and `stop-active-days` AWS tags to define different sets of active days for the start and stop actions, respectively. This allows for more granular control over when specific scheduling operations occur. ```AWS Tags start-active-days = "MON" stop-active-days = "FRI" ``` -------------------------------- ### Specifying AWS Service Scheduler Timezone Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Provides examples of the `timezone` AWS tag for setting the specific geographic timezone used by the scheduler to interpret start and stop times. If this tag is not defined, the scheduler defaults to UTC. ```AWS Tags timezone = "Europe/Paris" timezone = "America/New_York" ``` -------------------------------- ### Defining AWS Service Scheduler Active Days (Overall) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Illustrates examples for the `active-days` AWS tag, used to specify which days of the week the resource should be scheduled. The format supports single days, ranges (using `-`), and comma-separated lists of days or ranges. ```AWS Tags active-days = "MON-FRI" active-days = "MON,FRI,SUN" active-days = "THU,SUN-TUE" active-days = "MON-FRI,SUN-TUE" ``` -------------------------------- ### Schedule AWS Resources Active Mon-Fri 8am-6pm (Explicit Days) (JSON Tag Config) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/examples.md Configures a resource to be active from Monday 8:00 AM to Friday 6:00 PM, effectively shutting it down over the weekend. Uses explicit `scheduler:start-active-days` and `scheduler:stop-active-days` tags. Requires the scheduler tool to be enabled and monitoring the resource. ```JSON { "scheduler:enabled" = "true" "scheduler:start-active-days" = "MON" "scheduler:start-time" = "08:00" "scheduler:stop-active-days" = "FRI" "scheduler:stop-time" = "18:00" } ``` -------------------------------- ### Triggering Service Scheduler Step Function via AWS CLI (Multiple Selectors) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/manual-execution.md This command executes the AWS Step Function state machine with multiple selectors defined in the input JSON. The first selector targets RDS services with no delay, and the second targets EC2 services with a 30-second delay. This allows sequential execution of actions with pauses between them. This requires the AWS CLI installed and configured with appropriate permissions. ```bash aws stepfunctions start-execution \ --state-machine-arn arn:aws:states:::stateMachine:service-scheduler-start \ --input "{\"selectors\": [{\"services\":\"rds\",\"tags\":\"all\",\"delay\":0},{\"services\":\"ec2\",\"tags\":\"all\",\"delay\":30}]}" ``` -------------------------------- ### Defining AWS Service Scheduler Active Days of Month Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Provides examples for the `active-days-of-month` AWS tag, used to specify which days of the month the resource should be scheduled. The format supports single days, ranges (using `-`), and comma-separated lists of days or ranges. ```AWS Tags active-days-of-month = "8" active-days-of-month = "1-31" active-days-of-month = "1,7,14,21,28" active-days-of-month = "1-15,20-31" ``` -------------------------------- ### Schedule AWS Resources Mon/Fri 8am-6pm NY Time (JSON Tag Config) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/examples.md Configures a resource to be active on Mondays and Fridays from 8:00 AM to 6:00 PM, specifying the 'America/New_York' timezone for scheduling. Requires the scheduler tool to be enabled, monitoring the resource, and configured to handle timezones. ```JSON { "scheduler:enabled" = "true" "scheduler:active-days" = "MON,FRI" "scheduler:start-time" = "08:00" "scheduler:stop-time" = "18:00" "scheduler:timezone" = "America/New_York" } ``` -------------------------------- ### Defining AWS Service Scheduler Active Months Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Illustrates examples for the `active-months` AWS tag, used to specify which months (1-12) of the year the resource should be scheduled. The format supports single month numbers, ranges (using `-`), and comma-separated lists. ```AWS Tags active-months = "1" active-months = "1-12" active-months = "1,7,12" active-months = "1-6,8-12" ``` -------------------------------- ### Referencing Parameters via AWS Service Scheduler Tag Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Provides an example of the `parameter` AWS tag, which is used to reference a parameter stored in AWS Systems Manager Parameter Store. This allows scheduling configuration to be managed centrally rather than directly on the resource tags. ```AWS Tags parameter = "/service-scheduler/parameter-name" ``` -------------------------------- ### Defining AWS Service Scheduler Active Weeks Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Shows examples for the `active-weeks` AWS tag, used to define the range of weeks (1-53) within a year when the resource should be scheduled. The format supports single week numbers, ranges (using `-`), and comma-separated lists. ```AWS Tags active-weeks = "1" active-weeks = "1-53" active-weeks = "1,7,14,21,28" active-weeks = "1-15,20-53" ``` -------------------------------- ### Setting AWS Service Scheduler Enabled Tag Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/available-tags.md Provides examples for setting the `enabled` AWS tag to control whether the scheduler is active for a specific resource. Setting the tag to "true" enables scheduling, while "false" disables it, impacting the Step Functions state machine's ability to perform API calls. ```AWS Tags enabled = "true" enabled = "false" ``` -------------------------------- ### Schedule AWS Resources Apr-Sep 8am-6pm (JSON Tag Config) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/examples.md Configures a resource to be active only during the months of April to September, from 8:00 AM to 6:00 PM daily within those months. The `stop-active-months` tag with `JAN-DEC` ensures it's always eligible for stopping when outside the active time/month range, including automatically restarted instances like RDS. Requires the scheduler tool to be enabled, monitoring the resource, and supporting month-based schedules. ```JSON { "scheduler:enabled" = "true" "scheduler:start-time" = "08:00" "scheduler:stop-time" = "18:00" "scheduler:start-active-months" = "APR-SEP" "scheduler:stop-active-months" = "JAN-DEC" } ``` -------------------------------- ### Instantiating AWS Service Scheduler Terraform Module HCL Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/README.md This snippet demonstrates how to declare and configure the `service_scheduler` Terraform module. It specifies the module source and version, enables scheduling for a list of AWS services (e.g., ec2, asg, rds), sets the default timezone for scheduling, defines an application name, and configures the execution interval in minutes for the scheduler's core logic. Using this module requires a configured Terraform environment with access to the specified module source. ```hcl module "service_scheduler" { source = "phergoualch/service-scheduler/aws" version = ">= 2.0.0" enabled_services = ["ec2", "asg", "ecs", "rds", "documentdb", "lambda", "apprunner", "aurora", "elasticache", "cloudwatch"] default_timezone = "Europe/Paris" app_name = "service-scheduler" execution_interval = 6 } ``` -------------------------------- ### Defining Service Scheduler Parameters - JSON Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/parameter-store.md Illustrates the required JSON structure for a parameter store value used by the service scheduler. The keys correspond to tag names (e.g., start-time, stop-time, active-days) and the values define the scheduling parameters for resources linked to this configuration via Parameter Store. ```JSON { "start-time": "08:00", "stop-time": "18:00", "active-days": "MON-FRI" } ``` -------------------------------- ### Defining Iterated AWS Scheduler Tags Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/multiple-schedules.md Shows the basic format for defining a specific schedule using iterated AWS tags for a service scheduler. It appends a numerical iterator (like `:1`) to standard scheduler tags (`start-time`, `stop-time`, `active-days`) to differentiate this schedule from others. This allows defining multiple distinct schedules for a single resource. ```text scheduler:start-time:1 scheduler:stop-time:1 scheduler:active-days:1 ``` -------------------------------- ### Combining General and Iterated AWS Scheduler Tags Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/multiple-schedules.md Illustrates how general scheduler tags (`scheduler:start-time`, `scheduler:stop-time`) can be combined with specific iterated tags (`scheduler:stop-time:1`, `scheduler:active-days:1`). The scheduler will use the most specific iterated schedule that matches the current time, falling back to general values for any unspecified parameters within that specific schedule. ```text scheduler:start-time = "08:00" scheduler:stop-time = "18:00" scheduler:stop-time:1 = "20:00" scheduler:active-days:1 = "SAT-SUN" ``` -------------------------------- ### Configuring Custom Tags for AWS Service Scheduler Module (Terraform) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/customization.md This snippet demonstrates how to customize the tags used by the `service-scheduler` Terraform module. It shows overriding the default tag mapping for 'active-days' and changing the overall tag prefix, altering how the module identifies resources for scheduling. ```terraform module "service_scheduler" { source = "phergoualch/service-scheduler/aws" version = ">= 2.0.0" ... tags_mapping = { active-days = "days", } tags_prefix = "my-scheduler" } ``` -------------------------------- ### Setting Custom Resource Name Prefix for AWS Service Scheduler Module (Terraform) Source: https://github.com/phergoualch/terraform-aws-service-scheduler/blob/main/docs/usage/customization.md This snippet illustrates how to set a custom prefix for the AWS resources created by the `service-scheduler` Terraform module. By configuring the `app_name` parameter, deployed resources will use the specified prefix instead of the module's default name. ```terraform module "service_scheduler" { source = "phergoualch/service-scheduler/aws" version = ">= 2.0.0" ... app_name = "my-scheduler" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.