While you can manually administer AWS, it is easier to do so with Terraform. Plus, it is best to follow Infrastructure-as-Code (IaC) practice.

You can find all the code snippets below (and more) in the following Git repository: https://github.com/whyn07m3/terraform-examples/tree/main/aws

CloudWatch + Simple Notification Service (SNS)

The configuration below will setup a CloudWatch billing alarm that will get triggered when estimated monthly charge goes over $10. When alarm gets triggered it will send an email to the specified email address. Before receiving any billing alarm emails, you will first have to confirm the subscription, which AWS will send you upon creating this subscription.

--

--

  • include is a global configuration key
  • include takes another YAML file and adds it to the current one
  • The current YAML file overwrites keys with the same name found in the “included” YAML file
  • Including other YAML files is mainly useful to import templates, common utilities and setups, as well as breaking up big YAML files into smaller sections

--

--

  • workflow is a global configuration key
  • It uses rules key to specify conditions for creating a pipeline

Animated example:
When a scheduled event is triggered, GitLab checks pipeline configuration. It sees global workflow key and that its first rule matches. Because the rule specifies to never execute the pipeline, no pipeline is created.

--

--