Skip to content

Commit

Permalink
Merge pull request #1 from mikmorley/fix-node-fetch-version
Browse files Browse the repository at this point in the history
Version 1.1.0
  • Loading branch information
mikmorley authored Jul 6, 2023
2 parents 6bc2431 + 278d742 commit 6741c9d
Show file tree
Hide file tree
Showing 20 changed files with 510 additions and 6,149 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/terraform-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: terraform-lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@main

- name: Lint Terraform
uses: actionshub/terraform-lint@main
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ override.tf.json

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore node_modules
**/node_modules
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[![terraform-lint](https://github.com/mikmorley/aws-terraform-scheduled-ec2-ami-backup-automation/actions/workflows/terraform-lint.yml/badge.svg)](https://github.com/mikmorley/aws-terraform-scheduled-ec2-ami-backup-automation/actions/workflows/terraform-lint.yml)

# aws-terraform-scheduled-ec2-ami-backup-automation

Custom terraform module to deploy scheduled EC2 AMI backup automation.

### Usage
### Module Usage

```terraform
module "ami_scheduled_backup" {
Expand All @@ -13,12 +16,13 @@ module "ami_scheduled_backup" {
backup_tag = var.backup_tag
backup_retention = var.backup_retention
schedule_expression = var.cron_expressions
default_tags = var.default_tags
}
```

Once deployed, add the value specified as `backup_tag` to the EC2 resources to be backed up using this process. **For Example:** If the `backup_tag` is _Backup-AZ-A_, add a new Tag to the EC2 Instances with the _key_:_value_ of _Backup-AZ-A_:_yes_ (**Note:** The Tag value **must** be set to **yes** in order for the backup to be created).

#### Example
#### Example Module Usage

```terraform
module "ami_scheduled_backup" {
Expand All @@ -30,6 +34,10 @@ module "ami_scheduled_backup" {
backup_tag = "Backup-AZ-A"
backup_retention = 7 # Keep seven days of backs (AMIs & Snapshots)
schedule_expression = "cron(0 20 * * ? *)" # Backup at 8:00pm UTC Daily
default_tags = {
Owner = "Cloud Engineering"
}
}
```

Expand All @@ -44,3 +52,4 @@ module "ami_scheduled_backup" {
|`backup_tag`|_Optional_, Specify the tag that will be assigned to EC2 instances that are to be backed up (defaults to _Backup_). **Note:** The Tag value **must** be set to **yes** in order for the backup to be created.|
|`backup_retention`|_Optional_, Specify the number of days to keep the AMI and Snapshots (Defaults to 30).|
|`schedule_expression`|_Required_, Scheduling expression for triggering the Lambda Function using CloudWatch events. For example, cron(0 20 * * ? *) or rate(5 minutes).|
|`default_tags`|_Optional_, default tags to be applied to all resources.|
21 changes: 21 additions & 0 deletions lambda/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# aws-terraform-scheduled-ec2-ami-backup-lambda

## Manual (Re)Build of Lambda Package

Run the following script locally to rebuild the Lambda package manually.

```
#!/bin/bash
echo "Removing any cached node_modules"
rm -rf ./lambda/node_modules
echo "Installing NPM dependencies"
cd ./lambda && npm install && cd ..
echo "Removing original archive"
rm ./zip/lambda_function.zip
echo "Creating updated archive"
cd ./lambda && zip -r ../zip/lambda_function.zip .
```
1 change: 0 additions & 1 deletion lambda/node_modules/aws-lambda-nodejs-helpers/README.md

This file was deleted.

105 changes: 0 additions & 105 deletions lambda/node_modules/aws-lambda-nodejs-helpers/index.js

This file was deleted.

59 changes: 0 additions & 59 deletions lambda/node_modules/aws-lambda-nodejs-helpers/package.json

This file was deleted.

Loading

0 comments on commit 6741c9d

Please sign in to comment.