awslabs / aws-bootstrap-kit

Apache License 2.0
104 stars 22 forks source link

Add SNS notification and subscribe provided email when any AWS Config… #6

Closed ijemmy closed 3 years ago

ijemmy commented 3 years ago

Issue #, if available: N/A

Description of changes: Add SNS notification and subscribe provided email when any AWS Config Rule is breached

The current Config Rules do not notify users. We will notify user so they could take action and follow best practices in securing the root user.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

flochaz commented 3 years ago

LGTM, just would be great to add your testing procedure

ijemmy commented 3 years ago

I tested this by running unit tests and deployed to a new account. The unit tests pass (see below). And I have verified that the SNS was created with email subscription pending.

`----------------------------- --------- ---------- --------- --------- ------------------- File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 95.05 69.81 90 95.05
lib 94.19 56.25 88.24 94.19
account-provider.ts 100 100 100 100
account.ts 88.24 50 50 88.24 151-157
aws-config-recorder.ts 100 100 100 100
aws-organizations-stack.ts 92.31 64.29 80 92.31 81,87,101
dns.ts 80.95 40 100 80.95 39,48-51
organization-trail.ts 100 50 100 100 145
organization.ts 100 100 100 100
organizational-unit.ts 100 100 100 100
secure-root-user.ts 100 100 100 100
lib/account-handler 100 94.74 100 100
index.ts 100 94.74 100 100 48
lib/utils 100 50 100 100
index.ts 100 100 100 100
organizations.ts 100 50 100 100 35
----------------------------- --------- ---------- --------- --------- -------------------

Test Suites: 6 passed, 6 total Tests: 11 passed, 11 total Snapshots: 0 total Time: 12.669 s`