🔍 Builds a self-destructing S3 bucket and associated IAM Role for temporary file transfer workflows. Built with AWS CDK + TypeScript.
Getting Started
Run the following commands to install dependencies, build the CDK stack, and deploy the CDK Stack to AWS.
yarn install
yarn build
cdk bootstrap
cdk deploy
Note that EMAIL_SOURCE
, EMAIL_ADMIN
, and EMAIL_RECIPIENT
environment variables must be defined for cdk bootstrap
and cdk deploy
:
EMAIL_SOURCE
- the email being used by SES to send messages toEMAIL_ADMIN
andEMAIL_RECIPIENT
.EMAIL_ADMIN
- the email of the administrator creating the S3 bucket and IAM userEMAIL_RECIPIENT
- the email of the recipient of the S3 bucket read + write credentials
The simplest way to inject these variables into the environment is simply by defining them before invoking cdk bootstrap
or cdk deploy
:
EMAIL_SOURCE=source@test.com EMAIL_ADMIN=admin@test.com EMAIL_RECIPIENT=recipient@test.com cdk deploy
The following is an overview of each process performed by this CDK stack:
- Create S3 bucket
- Create IAM Role
- Create IAM Policies
- Send email to admin with login credentials
- Send email to recipient user with login credentials
- Send delete reminder after 29 days
- Delete everything after 30 days
- Send delete confirmation email
yarn install
- installs dependenciesyarn build
- builds the production-ready CDK Stackyarn test
- runs Jestcdk bootstrap
- bootstraps AWS Cloudformation for your CDK deploycdk deploy
- deploys the CDK stack to AWS
Notes
-
Includes tests with Jest.
-
Recommended to use
Visual Studio Code
with theFormat on Save
setting turned on.
Built with
Additional Resources
- CDK API Reference
- CDK TypeScript Reference
- CDK Assertion Package
- awesome-cdk repo
- aws-pdf-textract-pipeline
License
Opensourced under the MIT License.
Built with ❤️ by aeksco