https://github.com/willdady/cdk-aws-app-runner-scheduler
A CDK app for scheduled pausing of AWS App Runner services
https://github.com/willdady/cdk-aws-app-runner-scheduler
app-runner aws cdk typescript
Last synced: about 2 months ago
JSON representation
A CDK app for scheduled pausing of AWS App Runner services
- Host: GitHub
- URL: https://github.com/willdady/cdk-aws-app-runner-scheduler
- Owner: willdady
- License: mit
- Created: 2023-05-17T05:06:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-18T23:41:18.000Z (almost 2 years ago)
- Last Synced: 2025-03-25T21:22:10.192Z (2 months ago)
- Topics: app-runner, aws, cdk, typescript
- Language: TypeScript
- Homepage:
- Size: 348 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CDK AWS App Runner Scheduler
A reference AWS CDK application for scheduling the pausing and resuming of AWS App Runner services.
Useful for dev environments where you want to pause AWS App Runner services out-of-hours to save money.
## Setup
Install dependencies.
Requires Node.js >= v16```
npm install
```## Deployment
```
npm run cdk -- deploy AwsAppRunnerScheduler
```## Usage
This project defines `AwsAppRunnerScheduler`, a custom CDK construct which pauses/resumes any AWS App Runner services matching the provided tag on the provided schedule.
For example, the following will pause ALL AWS App Runner services tagged with key `environment` and value `development` at 02:00 UTC and resume the service at 21:00 UTC daily.
```typescript
new AwsAppRunnerScheduler(this, 'ExampleScheduler', {
serviceTag: {
key: 'environment',
value: 'development',
},
pauseCronOptions: {
hour: '2',
minute: '0',
},
resumeCronOptions: {
hour: '21',
minute: '0',
},
});
```Note, cron options are in **UTC time** *not* your local time.
Also, `serviceTag.key` and `serviceTag.value` are **case-sensitive**.### SNS
You may also optionally provide `snsTopic` to the `AwsAppRunnerScheduler` constructor to be notified when a service is paused and resumed.
```typescript
const mySnsTopic = new sns.Topic(this, 'MySnsTopic');new AwsAppRunnerScheduler(this, 'ExampleScheduler', {
...,
snsTopic: mySnsTopic,
});
```