AWS Prescriptive Guidance
Best practices for using the AWS CDK in TypeScript to create IaC projects
AWS Prescriptive Guidance
Copyright ? 2024 Amazon Web Services, Inc. and/or its a?liates. All rights reserved.
AWS Prescriptive Guidance
Best practices for using the AWS CDK in TypeScript to create IaC
projects
AWS Prescriptive Guidance: Best practices for using the AWS CDK in
TypeScript to create IaC projects
Copyright ? 2024 Amazon Web Services, Inc. and/or its a?liates. All rights reserved.
Amazon's trademarks and trade dress may not be used in connection with any product or service
that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any
manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are
the property of their respective owners, who may or may not be a?liated with, connected to, or
sponsored by Amazon.
AWS Prescriptive Guidance
Best practices for using the AWS CDK in TypeScript to create IaC
projects
Table of Contents
Introduction .....................................................................................................................................
Objectives .........................................................................................................................................
Best practices ...................................................................................................................................
Organize code for large-scale projects ....................................................................................................
Why code organization is important ..................................................................................................
1
2
3
3
3
How to organize your code for scale .................................................................................................. 3
Sample code organization ..................................................................................................................... 4
Develop reusable patterns .......................................................................................................................... 6
Abstract Factory ...................................................................................................................................... 6
Chain of Responsibility .......................................................................................................................... 7
Create or extend constructs ....................................................................................................................... 8
What a construct is ................................................................................................................................. 8
What the di?erent types of constructs are ....................................................................................... 8
How to create your own construct ...................................................................................................... 9
Create or extend an L2 construct ..................................................................................................... 10
Create an L3 construct ........................................................................................................................ 11
Escape hatch .......................................................................................................................................... 12
Custom resources .................................................................................................................................. 13
Follow TypeScript best practices ............................................................................................................ 16
Describe your data ................................................................................................................................ 16
Use enums .............................................................................................................................................. 16
Use interfaces ........................................................................................................................................ 17
Extend interfaces .................................................................................................................................. 18
Avoid empty interfaces ........................................................................................................................ 18
Use factories .......................................................................................................................................... 19
Use destructuring on properties ........................................................................................................ 19
De?ne standard naming conventions ............................................................................................... 19
Don't use the var keyword ................................................................................................................. 20
Consider using ESLint and Prettier ................................................................................................... 20
Use access modi?ers ............................................................................................................................ 21
Use utility types .................................................................................................................................... 21
Scan for security vulnerabilities and formatting errors ..................................................................... 22
Security approaches and tools ........................................................................................................... 22
Common development tools .............................................................................................................. 23
iii
AWS Prescriptive Guidance
Best practices for using the AWS CDK in TypeScript to create IaC
projects
Develop and re?ne documentation ....................................................................................................... 23
Why code documentation is required for AWS CDK constructs .................................................. 24
Using TypeDoc with the AWS Construct Library ............................................................................ 24
Adopt a test-driven development approach ........................................................................................ 25
Unit test .................................................................................................................................................. 26
Integration test ...................................................................................................................................... 28
Use release and version control for constructs ................................................................................... 29
Version control for the AWS CDK ...................................................................................................... 29
Repository and packaging for AWS CDK constructs ...................................................................... 29
Construct releasing for the AWS CDK .............................................................................................. 30
Enforce library version management ..................................................................................................... 31
FAQ ................................................................................................................................................. 33
What problems can TypeScript solve? ................................................................................................... 33
Why should I use TypeScript? ................................................................................................................. 33
Should I use the AWS CDK or CloudFormation? ................................................................................. 33
What if the AWS CDK doesn't support a newly launched AWS service? ......................................... 33
What are the di?erent programming languages supported by the AWS CDK? ............................. 34
How much does the AWS CDK cost? ..................................................................................................... 34
Next steps ...................................................................................................................................... 35
Resources ........................................................................................................................................ 36
Document history .......................................................................................................................... 37
Glossary .......................................................................................................................................... 38
# ..................................................................................................................................................................... 38
A ..................................................................................................................................................................... 39
B ..................................................................................................................................................................... 42
C ..................................................................................................................................................................... 44
D ..................................................................................................................................................................... 47
E ..................................................................................................................................................................... 51
F ..................................................................................................................................................................... 53
G ..................................................................................................................................................................... 54
H ..................................................................................................................................................................... 55
I ...................................................................................................................................................................... 56
L ..................................................................................................................................................................... 59
M .................................................................................................................................................................... 60
O .................................................................................................................................................................... 64
P ..................................................................................................................................................................... 66
iv
AWS Prescriptive Guidance
Best practices for using the AWS CDK in TypeScript to create IaC
projects
Q .................................................................................................................................................................... 69
R ..................................................................................................................................................................... 69
S ..................................................................................................................................................................... 72
T ..................................................................................................................................................................... 76
U ..................................................................................................................................................................... 77
V ..................................................................................................................................................................... 78
W .................................................................................................................................................................... 78
Z ..................................................................................................................................................................... 79
v
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- how to dns enumeration
- declare enum in typescript hers index
- ecmascript language specification
- json rpc microchip technology
- advanced chisel topics university of california berkeley
- compressed double array tries for string dictionaries supporting fast
- typescript method overriding tutorial kart
- ecmascript a general purpose cross platform programming language
- typescript anonymous functions syntax examples tutorial kart
- typescript string length example tutorial kart
Related searches
- va irrl guidance 2019
- college guidance consultants
- how to reference guidance documents
- public guidance documents
- agency guidance document
- don budget guidance manual
- college guidance consultants texas
- electronic submission guidance fda
- fda ecopy guidance document
- guidance document format
- cgmp guidance fda
- fda guidance equipment qualification