Skip to content

Commit 9a86b80

Browse files
authored
TF: no duplicate OU IDs possible, new license tag; ReadMe: supply chain remark (#3)
* TF: no duplicate OU IDs possible, new license tag; ReadMe: supply chain remark * ReadMe: TF least-privilege remark
1 parent be2d983 commit 9a86b80

5 files changed

Lines changed: 50 additions & 26 deletions

File tree

README.md

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
_AWS Backup is the official backup service for RDS, Aurora, DynamoDB and
44
DocumentDB databases; EBS disk volumes; entire EC2 instances; EFS file systems;
5-
entire S3 buckets; and, as of November, 2025,
5+
entire S3 buckets; and, as of 2025,
66
[Elastic Kubernetes Service (EKS) clusters](https://aws.amazon.com/about-aws/whats-new/2025/11/aws-backup-supports-amazon-eks).
77
"On-demand" backups include ones started in the AWS Console, or with
8-
[start-backup-job](https://docs.aws.amazon.com/cli/latest/reference/backup/start-backup-job.html)
9-
in the AWS command-line interface, or in scripts, Step Functions, Lambda
10-
functions, and programs._
8+
[`start-backup-job`](https://docs.aws.amazon.com/cli/latest/reference/backup/start-backup-job.html)
9+
in the command-line interface, or in scripts, Step Functions, Lambda functions,
10+
and programs._
1111

1212
Backup Events automatically **copies on‑demand backups to**:
1313

@@ -23,6 +23,14 @@ It also **saves money** by scheduling the original backup for deletion.
2323
It **monitors** on-demand backups and copies, sending messages to an error
2424
queue if they fail.
2525

26+
>🔒 Software supply chain security is on everyone's mind. This tool's
27+
two Lambda functions share one source file that's short enough to read
28+
(< 250 lines of code). I've made GitHub releases immutable as of
29+
`v2.1.1` . AWS
30+
[patches](https://docs.aws.amazon.com/lambda/latest/dg/runtime-management-shared.html#:~:text=Lambda%20is%20responsible%20for%20applying,Auto%20runtime%20update%20mode.)
31+
the stock Lambda runtime, which provides the Python standard library and the
32+
AWS software development kit (boto, boto3). There are no other dependencies.
33+
2634
---
2735

2836
You can get started immediately, or customize Backup Events.
@@ -111,7 +119,7 @@ retain the sample vaults, disable Backup Events instead, by changing the
111119
<br/>
112120

113121
If you sometimes take on-demand backups, update your Backup Events
114-
CloudFormation StackSet or stacks. `v2.1.0`&nbsp;:
122+
CloudFormation StackSet or stacks. `v2.1.0` or a later version:
115123

116124
- Ignores scheduled backups from backup plans (because plans support
117125
CopyActions).
@@ -192,11 +200,11 @@ Click to view the architecture diagram:
192200

193201
- Your main region will double as the _alternate_ for your backup region.
194202

195-
4. Create a
196-
[CloudFormation stack](https://console.aws.amazon.com/cloudformation/home)
197-
"With new resources". Under "Specify template", select "Upload a template
198-
file", then select "Choose file" and navigate to a locally-saved copy of
199-
[cloudformation/backup_events_aws.yaml](/cloudformation/backup_events_aws.yaml?raw=true)
203+
4. [Create a CloudFormation stack](https://console.aws.amazon.com/cloudformation/home#/stacks/create).
204+
205+
Under "Specify template", select "Upload a template file", then select
206+
"Choose file" and navigate to a locally-saved copy of
207+
[cloudformation/backup_events_aws.yaml](/../../blob/v2.1.1/cloudformation/backup_events_aws.yaml?raw=true)
200208
[right-click to save as...]. On the next page, set:
201209

202210
- Stack name - _Copy and paste from "For Reference"_
@@ -393,11 +401,11 @@ resources potentially deployed to the backup account.
393401

394402
- **CloudFormation**<br/>_Easy_ &check;
395403

396-
Create a
397-
[CloudFormation StackSet](https://console.aws.amazon.com/cloudformation/home#/stacksets).
404+
[Create a CloudFormation StackSet](https://console.aws.amazon.com/cloudformation/home#/stacksets/create).
405+
398406
Under "Specify template", select "Upload a template file", then select
399407
"Choose file" and upload a locally-saved copy of
400-
[cloudformation/backup_events_aws.yaml](/cloudformation/backup_events_aws.yaml?raw=true)
408+
[cloudformation/backup_events_aws.yaml](/../../blob/v2.1.1/cloudformation/backup_events_aws.yaml?raw=true)
401409
[right-click to save as...].
402410

403411
- Set parameters as in Step&nbsp;4 of the
@@ -416,11 +424,12 @@ resources potentially deployed to the backup account.
416424

417425
```terraform
418426
module "backup_events_stackset" {
419-
source = "git::https://github.com/sqlxpert/backup-events-aws.git//terraform-multi?ref=v2.1.0"
427+
source = "git::https://github.com/sqlxpert/backup-events-aws.git//terraform-multi?ref=v2.1.1"
420428
# Reference a specific version from github.com/sqlxpert/backup-events-aws/releases
429+
# Check that the release is immutable!
421430
422-
backup_events_stackset_regions = ["us-east-1", "us-west-2", ]
423-
backup_events_stackset_organizational_unit_ids = ["ou-abcd-efghijkl", ]
431+
backup_events_stackset_regions = ["us-east-1", "us-west-2",]
432+
backup_events_stackset_organizational_unit_ids = ["ou-abcd-efghijkl",]
424433
425434
backup_events_stackset_params = {
426435
BackupAccountId = "999977775555"
@@ -466,10 +475,12 @@ _In accordance with the software license, nothing in this section creates a
466475
warranty, an indemnification, an assumption of liability, etc. Use this
467476
software at your own risk. You are encouraged to evaluate the source code._
468477
478+
### Security Design Goals
479+
469480
<details>
470-
<summary>Security details...</summary>
481+
<summary>Security goals...</summary>
471482
472-
### Security Design Goals
483+
<br/>
473484
474485
- Least-privilege roles for the AWS Lambda functions
475486
- The role for the function that reduces retention of original backups after
@@ -495,8 +506,15 @@ software at your own risk. You are encouraged to evaluate the source code._
495506
function that reduces retention of original backups after they have been
496507
copied applies a full-day margin.
497508
509+
</details>
510+
498511
### Security Steps You Can Take
499512
513+
<details>
514+
<summary>Security actions...</summary>
515+
516+
<br/>
517+
500518
- Prevent modification of the components, most of which are identified by
501519
`BackupEvents` in ARNs and in the automatic `aws:cloudformation:stack-name`
502520
tag.
@@ -505,6 +523,11 @@ software at your own risk. You are encouraged to evaluate the source code._
505523
of Lambda's AddPermission operation.
506524
- Prevent use of the function roles with arbitrary functions. See comments.
507525
- Log infrastructure changes using AWS CloudTrail, and set up alerts.
526+
- If you use Terraform, do not use it with an AWS access key and do not give it
527+
full AWS administrative privileges. Instead, follow AWS's
528+
[Best practices for using the Terraform AWS Provider: Security best practices](https://docs.aws.amazon.com/prescriptive-guidance/latest/terraform-aws-provider-best-practices/security.html).
529+
Do the extra work of defining a least-privilege IAM role for deploying each
530+
workload. Configure Terraform to assume workload-specific roles.
508531
- Instead of relying on sample vaults, on default `aws/` KMS keys, and on the
509532
AWSBackupDefaultServiceRole , define custom equivalents with least-privilege
510533
resource- and/or identity-based policies tailored to your needs.

python/requirements.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Cross-account, cross-region backups with AWS Backup and EventBridge
22
# github.com/sqlxpert/backup-events-aws GPLv3 Copyright Paul Marcelin
33

4-
boto3
5-
botocore
4+
# boto3
5+
# botocore
6+
# Included in the AWS Lambda Python runtime; AWS manages patching for all users
7+
# https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html

terraform-multi/locals.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ locals {
1717
backup_events_tags = merge(
1818
{
1919
terraform = "1"
20+
source = "github.com/sqlxpert/backup-events-aws/blob/main/${local.module_directory}"
21+
rights = "GPLv3. Copyright Paul Marcelin."
2022
# CloudFormation stack tag values must be at least 1 character long!
2123
# https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Tag.html#API_Tag_Contents
22-
23-
source = "https://github.com/sqlxpert/backup-events-aws/blob/main/${local.module_directory}"
2424
},
2525
var.backup_events_tags,
2626
)
2727
}
28-
29-

terraform-multi/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ resource "aws_cloudformation_stack_set_instance" "backup_events" {
147147

148148
stack_set_instance_region = each.value.region
149149
deployment_targets {
150-
organizational_unit_ids = sort(
150+
organizational_unit_ids = sort(toset(
151151
var.backup_events_stackset_organizational_unit_ids
152-
)
152+
))
153153
}
154154
retain_stack = false
155155

terraform-multi/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# github.com/sqlxpert/backup-events-aws GPLv3 Copyright Paul Marcelin
33

44

5+
56
variable "backup_events_stackset_name_suffix" {
67
type = string
78
description = "Optional CloudFormation StackSet name suffix, for blue/green deployments or other scenarios in which multiple StackSets created from the same template are needed."

0 commit comments

Comments
 (0)