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
- When Every Day at 8PM
- When Weekdays at 8AM
- When Restart Requested
- Set Mode to Stop
- Set Mode to Start
- Set Mode to Restart
- Set Config Parameters
- Check Restart Mode
- Select Project Form
- List All Projects
- List ECS Services
- Batch ECS Services
- Describe ECS Services
- Filter Scheduled Services
55 steps in total.
Similar automations
Reports, Analytics & DashboardsSend daily AWS news digest to Microsoft Teams with Bedrock Claude filtering12 stepsImage, Video & AudioTranscribe Audio from AWS S3 with AWS Transcribe4 stepsData Sync & ETLSend daily JLPT kanji-safe lessons to Microsoft Teams with Sheets and Claude18 stepsEmail AutomationSend an Email with AWS SES2 steps