Skip to content
NEWMarketplace and your team: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Forms & Surveys

Forms & Surveys

Schedule AWS ECS services for office hours with a self-service form and Teams alerts

On a schedule, it processes form answers.

What it does

## Schedule AWS ECS services for office hours with a self-service restart form and Teams alerts ### How it works This workflow cuts AWS ECS cost by scaling tagged services to 0 after hours and restoring them on weekday mornings, across multiple projects, clusters and AWS accounts. Teammates who don't use AWS get a self-service form to restart or extend services in an emergency. - Nightly stop: every service tagged auto-schedule=office-hours is scaled to 0. Its task count is saved in a saved-desired-count tag, so no database is needed. - Weekday start: each service is restored to its saved task count. - Restart form: pick a project, the services and a duration. Services are started (or extended), checked until healthy, then scaled back to 0 when the time is up, unless it's office hours by then. An override-until tag keeps the nightly stop from interrupting them. - Teams receives a card for every stop, start, restart, failure and re-stop. - All ECS API calls go through the ECS API section at the bottom of this workflow: the ECS nodes call this same workflow, and Route by AWS Account picks the credential for each account. No separate sub-workflow is needed. ### Setup steps 1. Tag each service to schedule with auto-schedule = office-hours. Optional: display-name = a friendly name shown in the form. 2. In each AWS account, create an IAM role n8n can assume that allows ecs:ListServices, ecs:DescribeServices, ecs:UpdateService, ecs:TagResource and ecs:UntagResource. Tip: restrict the last three with the condition aws:ResourceTag/auto-schedule = office-hours. 3. Create one AWS (Assume Role) credential per account and select it in Handle ECS for Account-A / Handle ECS for Account-B. For more accounts, add a rule to Route by AWS Account and duplicate a handler node. With a single account, keep one branch. 4. In Teams, open Workflows, create a flow from "Send webhook alerts to channel" and copy its URL. 5. Fill in Set Config Parameters: projects (project, account key, region, cluster), teamsWebhookUrl, restartFormUrl (the form's production URL), office hours and timezone. Use the same timezone in the workflow settings. 6. Protect the form before activating (form authentication, or SSO in front of n8n). Run When Every Day at 8PM once against a test service, then activate. ### Customization - Change the trigger times together with officeStartHour / officeEndHour. - Chang

The steps

  1. When Every Day at 8PM
  2. When Weekdays at 8AM
  3. When Restart Requested
  4. Set Mode to Stop
  5. Set Mode to Start
  6. Set Mode to Restart
  7. Set Config Parameters
  8. Check Restart Mode
  9. Select Project Form
  10. List All Projects
  11. List ECS Services
  12. Batch ECS Services
  13. Describe ECS Services
  14. Filter Scheduled Services

55 steps in total.

Similar automations