Skip to content

This constructor stack includes a function to automatically stop a database or cluster that will automatically start in 7 days.

License

Notifications You must be signed in to change notification settings

gammarers/aws-rds-database-auto-running-protection-stack

Repository files navigation

AWS RDS Database Auto Running Protection Stack

GitHub npm (scoped) PyPI Nuget GitHub Workflow Status (branch) GitHub release (latest SemVer)

View on Construct Hub

This constructor stack includes a function to automatically stop a database or cluster that will automatically start in 7 days.

Warning

v2.1.0: Stack props add option resourceNamingOption default ResourceNamingType.DEFAULT is cdk generated name if you want to maintain compatibility with versions below v2.1.0, please include the following settings (ResourceNamingType.AUTO).

new RDSDatabaseAutoRunningProtectionStack(app, 'RDSDatabaseAutoRunningProtectionStack', {
  stackName: 'rds-database-auto-running-protection-stack',
  targetResource: {
    tagKey: 'AutoRunningProtection',
    tagValues: ['YES'],
  },
  resourceNamingOption: {
    type: RDSDatabaseAutoRunningProtectionStackResourceNamingType.AUTO, // HERE
  },
});

Resources

This construct creating resource list.

  • StepFunctions(StateMachine)
  • IAM Role (StepFunctions)
  • IAM Policy (StepFunctions)
  • EventBridge
  • IAM Role (EventBridge)

Install

TypeScript

install by npm

npm install @gammarers/aws-rds-database-auto-running-protection-stack

install by yarn

yarn add @gammarers/aws-rds-database-auto-running-protection-stack

install by pnpm

pnpm add @gammarers/aws-rds-database-auto-running-protection-stack

install by bun

bun add @gammarers/aws-rds-database-auto-running-protection-stack

Python

pip install gammarers.aws-rds-database-auto-running-protection-stack

C# / .NET

dotnet add package Gammarers.CDK.AWS.RDSDatabaseAutoRunningProtectionStack

Example

Code

import { RDSDatabaseAutoRunningProtectionStack } from '@gammarers/aws-rds-database-auto-running-protection-stack';

new RDSDatabaseAutoRunningProtectionStack(app, 'RDSDatabaseAutoRunningProtectionStack', {
  stackName: 'rds-database-auto-running-protection-stack',
  targetResource: {
    tagKey: 'AutoRunningProtection',
    tagValues: ['YES'],
  },
  resourceNamingOption: {
    type: RDSDatabaseAutoRunningProtectionStackResourceNamingType.DEFAULT,
  },
  notifications: {
    emails: [ // "Incoming Sample Message - EMAIL"
      '[email protected]',
      '[email protected]',
    ],
    slack: { // "Incoming Sample Message - Slack"
      webhookSecretName: 'example/slack/webhook', // Slack webhook secret
    },
  },
});

Slack webhook secret

Please save it in AWS Secrets Manager in the following format.

get your slack webhook url parts

https://hooks.slack.com/services/<workspace>/<channel>/<whebook>
SecretKey SecretValue
Workspace <workspace>
Channel <channel>
Webhook <whebook>

Incoming Sample Message

EMAIL

Slack

License

This project is licensed under the Apache-2.0 License.

About

This constructor stack includes a function to automatically stop a database or cluster that will automatically start in 7 days.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published