Skip to content

Provisioning Compute Notifier stack which will trigger a notification if you have EC2 instances running in AWS

Notifications You must be signed in to change notification settings

yanzv/ComputeNotifer

Repository files navigation

Compute Notifier

Compute Notifier stack will provision Cloud Watch event trigger, lambda and an SNS topic. The event trigger will be triggered based on the cron expression which will trigger the lambda that will push SNS notification if there are any EC2 instances running in the AWS account.
The configuration is defined in cdk.json

Provisioning Compute Notifier

  • Define your configuration in cdk.json
  • Bootstrap
    cdk --profile $AWS_PROFILE bootstrap
  • synth
    cdk --profile $AWS_PROFILE synth
  • deploy
    cdk --profile $AWS_PROFILE deploy
  • destroy
    cdk --profile $AWS_PROFILE destroy

You can set deployment environment by setting environment variable DEPLOY_ENVIRONMENT
DEPLOY_ENVIRONMENT=prod cdk --profile $AWS_PROFILE synth
Default environment is dev

Adding Auxiliary Configuration

The cdk.json configuration can be overwritten per invironment by adding a config file into the aux_config folder. The name of the file should be {env}.json
The structure of aux config should be:

{
  "emails": [
    "email address"
  ],
  "schedule_expression": "cron(* 18 ? * * *)"
}

Notes

Cron time is in GMT

Requirements

  • AWS CDK
    npm install -g aws-cdk
  • Node.js >= 10.3.0
  • Python >= 3.6
  • Create python virtual env
    • python3 -m venv .env
  • Run pip3 to install required modules
    • pip3 install .

About

Provisioning Compute Notifier stack which will trigger a notification if you have EC2 instances running in AWS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published