|
1 |
| -# Welcome to your CDK TypeScript project! |
| 1 | +# AWS Lambda Powertools (TypeScript) examples in CDK |
2 | 2 |
|
3 |
| -This is a blank project for TypeScript development with CDK. |
| 3 | +This is a deployable CDK app that deploys AWS Lambda functions as part of a CloudFormation stack. These Lambda functions use the utilities made available as part of AWS Lambda Powertools (TypeScript) to demonstrate their usage. |
4 | 4 |
|
5 |
| -The `cdk.json` file tells the CDK Toolkit how to execute your app. |
| 5 | +You will need to have a valid AWS Account in order to deploy these resources. These resources may incur costs to your AWS Account. The cost from **some services** are covered by the [AWS Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all) but not all of them. If you don't have an AWS Account follow [these instructions to create one](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/). |
6 | 6 |
|
7 |
| -## Useful commands |
| 7 | +The example functions, located in the `lib` folder, are invoked automatically, twice, when deployed using the CDK construct defined in `lib/example-function.ts`. The first invocation demonstrates the effect on logs/metrics/annotations when the Lambda function has a cold start, and the latter without a cold start. |
8 | 8 |
|
9 |
| - * `npm run build` compile typescript to js |
10 |
| - * `npm run watch` watch for changes and compile |
11 |
| - * `npm run test` perform the jest unit tests |
12 |
| - * `cdk deploy` deploy this stack to your default AWS account/region |
13 |
| - * `cdk diff` compare deployed stack with current state |
14 |
| - * `cdk synth` emits the synthesized CloudFormation template |
| 9 | +## Deploying the stack |
| 10 | + |
| 11 | + * Ensure that CDK v2 is installed globally on your machine (if not, run `npm install -g aws-cdk`) |
| 12 | + * Navigate to this location of the repo in your terminal (`examples/cdk`) |
| 13 | + * `npm install` |
| 14 | + * `cdk deploy --all --profile <YOUR_AWS_PROFILE>` |
| 15 | + |
| 16 | +Note: Prior to deploying you may need to run `cdk bootstrap aws://<YOU_AWS_ACCOUNT_ID>/<AWS_REGION> --profile <YOUR_AWS_PROFILE>` if you have not already bootstrapped your account for CDK. |
| 17 | + |
| 18 | +## Viewing Utility Outputs |
| 19 | + |
| 20 | +All utility outputs can be viewed in the Amazon CloudWatch console. |
| 21 | + |
| 22 | + * `Logger` output can be found in Logs > Log groups |
| 23 | + * `Metrics` output can be found in Metrics > All metrics > CdkExample |
| 24 | + * `Tracer` output can be found in X-Ray traces > Traces |
0 commit comments