Create a good CDK construct README
Creating a good CDK Construct README
Leveraging a CDK module should be as easy as possible for the community. We believe that starts with a good README file. Below are some tips for how to write a good README for a CDK Construct or Example
-
Define the purpose of the Construct/Example
- What is abstracted
- What benefits does it provide?
Good Example:
“This construct will create an guaranteed-secured S3 bucket with encryption enabled by default and prevents disabling all encryption. Additionally the public blocks will be enforced and can’t be disabled. This way you know you’re always creating private and secured buckets.”
Bad Example:
“An s3 bucket wrapper.”
-
Show an example usage of the Construct
- Include reasonable example values
- Show any additional usages you believe will be common
- Bonus points if you include a full
cdk synth
pipeline so anyone can just clone your code, runcdk synth
and have a usable CloudFormation template. - Note that jsii will automatically convert typescript code examples into python. See this issue for more details
-
Mention any design considerations or gotchas
- There may be use cases where you know your Construct/Example won’t work well. Mention those
- If constructs make use of custom resources, document it and explain its use. Ideally, any custom resource you use for CDK should be available on the Serverless Application Repository
- Publish IAM permissions necessary to deploy your construct (don’t forget about permissions necessary for rollback)
- As with all good open-source code, license and contribution options should be included.
Here is an example of a good CDK Construct README. We will have more examples coming soon!