phillip-le / phillip-le.github.io

https://phillip-le.github.io/
1 stars 0 forks source link

Introduction to CDK #72

Open phillip-le opened 2 months ago

phillip-le commented 2 months ago

const template = Template.fromStack(stack);

const result = JSON.stringify(template).replace( /"S3Key":"[^"]+"/g, '"S3Key":"[REMOVED]"', );

expect(JSON.parse(result)).toMatchSnapshot();



- Prefer to be overly verbose because infrastructure typically doesn't change
- `progress: events` is helpful for logging in CI/CD
- Stateless vs Stateful resources
- Changing logical IDs will cause resources to be created and destroyed
- Sometimes you will want to prefer not explicitly setting a name so that CDK can handle cutover of resource creation / deletion under the hood
- Construct trees
- If you're using NodeJsFunction, make sure your CI agent has git and bash

References:
- Don't change logical IDs: https://docs.aws.amazon.com/cdk/v2/guide/identifiers.html#identifiers_logical_ids
- Current set of feature flags: https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cx-api/FEATURE_FLAGS.md