0% found this document useful (0 votes)
17 views2 pages

aws_cdk_practice_tasks

Download as txt, pdf, or txt
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 2

AWS CDK Practice Tasks

BEGINNER
1. Install AWS CDK and Run Your First App:
- Install AWS CDK CLI and configure AWS credentials.
- Initialize a new CDK project with `cdk init app --language typescript` or your
preferred language.
- Deploy a basic stack that creates an S3 bucket.

2. Create a Lambda Function:


- Define a Lambda function in your stack that logs "Hello from Lambda!" to
CloudWatch.
- Set up permissions and deploy, then trigger it manually to test.

3. Add IAM Policies to Resources:


- Add an IAM role and attach permissions to your Lambda function to allow it to
access S3.
- Verify the permissions are correctly applied.

4. Create a DynamoDB Table:


- Add a DynamoDB table to your stack.
- Specify table attributes like partition key and billing mode.

5. Use Environment Variables in Lambda:


- Set up environment variables in your Lambda function through CDK.
- Modify your function code to log these variables, deploy, and test.

INTERMEDIATE
6. Set Up a VPC with Subnets:
- Define a VPC with public and private subnets in a CDK stack.
- Verify the network structure in the AWS console.

7. Deploy an API Gateway with Lambda Integration:


- Create a REST API using API Gateway that triggers your Lambda function.
- Test the setup by sending HTTP requests to the endpoint.

8. Create a Simple CI/CD Pipeline:


- Use CodePipeline in your CDK stack to create a basic pipeline that deploys
changes automatically.
- Set up a source stage (e.g., GitHub or S3) and a build stage (CodeBuild).

9. Add CloudWatch Alarms:


- Define CloudWatch alarms in your stack to monitor your Lambda or DynamoDB
performance.
- Test by triggering alarms based on specific metrics like error rates or
request counts.

10. Use Parameters and Outputs:


- Add parameters to your CDK stack to make resources configurable (e.g., table
name or bucket name).
- Output values (e.g., bucket URL) and test by accessing them after deployment.

ADVANCED
11. Integrate with Secrets Manager:
- Create a secret in Secrets Manager through CDK and use it in your Lambda
function.
- Verify that the Lambda can securely access and retrieve the secret.
12. Implement Cross-Stack References:
- Create two CDK stacks, one with shared resources (e.g., a VPC) and another
that uses it.
- Set up cross-stack references and deploy both stacks.

13. Manage Multiple Environments (Dev/Prod):


- Use CDK environments to define different configurations for Dev and Prod.
- Deploy your app in both environments to see different resource configurations.

14. Write Unit Tests for Your CDK Stack:


- Write basic tests for your stack using the AWS CDK assertions library.
- Test for properties such as resource count, specific configurations, and
naming conventions.

15. Deploy a Full Stack Application with CDK:


- Define a full application stack with a VPC, API Gateway, Lambda functions,
DynamoDB, and S3 for storage.
- Deploy and verify that the components work together as expected.

You might also like