Voiced by Amazon Polly |
Introduction
A general-purpose code generator driven by machine learning; Amazon CodeWhisperer gives you real-time code recommendations. CodeWhisperer dynamically creates code suggestions based on your existing code and comments as you write it. Your customized recommendations might be as small as a single line remark or as large as complete entire functions.
Freedom Month Sale — Upgrade Your Skills, Save Big!
- Up to 80% OFF AWS Courses
- Up to 30% OFF Microsoft Certs
AWS Cloud Development Kit
An open-source software development framework called the AWS Cloud Development Kit (AWS CDK) is used to specify cloud infrastructure in code and provision it using AWS CloudFormation.
There are two main components of the AWS CDK:
1. The AWS CDK Construct Library is a set of pre-written, modular, and reusable code segments known as constructs that you may use, alter, and include to rapidly build your infrastructure. Reducing the complexity needed to describe and integrate AWS services is the aim of the AWS CDK Construct Library, which is used for developing applications on AWS.
2. A command line tool for working with CDK apps is the Amazon CDK Command Line Interface (AWS CDK CLI). To develop, oversee, and implement your AWS CDK projects, use the CDK CLI. The CDK Toolkit is another name for the CDK CLI.
TypeScript, JavaScript, Python, Java, C#/.Net, and Go are all supported by the AWS CDK.
Steps to Follow
Step 1: Install npm
Install npm using the following link. npm installer.
Once installed, you check the installation.
Install or update the AWS CDK CLI from npm using the command.
1 |
npm i -g aws-cdk |
Check the installation of AWS CDK CLI.
You may get this error when check the version of installed AWS CDK CLI in VS Code PowerShell terminal. To fix this error run the below command in the terminal.
1 |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser |
After executing the above command, you can check the installation of AWS CDK CLI.
Step 2: Install AWS CLI to your local Machine
Use the following link to download and install AWS CLI : AWS CLI
Once installed, you can check the installation using the below command.
1 |
aws –version |
Step 3: Bootstrapping CDK Environment.
Dedicated Amazon S3 buckets and other containers must be accessible to AWS CloudFormation during deployment to deploy stacks using the AWS CDK. Bootstrapping is the process of developing these. To bootstrap, run the below command:
1 |
cdk bootstrap aws://ACCOUNT-NUMBER/REGION |
Step 4: Create a CDK project
To create a new CDK Project, create a directory for it, then, inside the directory, issue cdk init.
Open the project in VS Code
Issue the below command:
1 |
General Format: cdk init <em>TEMPLATE</em> --language <em>LANGUAGE</em> |
1 |
cdk init <em>app</em> –language python |
Open the file shown below:
You need to write the code to create the resources S3 Bucket, VPC and RDS database instance.
Step 5: Create an S3 Bucket
To create a s3 bucket, just write the comment as shown below, the code whisperer will suggest the code.
Press Tab to accept the suggestions and ESC key to reject the suggestions.
Left and right arrow keys to Navigate between suggestions. Use Alt+C to manually trigger CodeWhisperer any time.
To fix the above “S3 is not defined” error, we need to import s3 construct as follows.
To know more about amazon s3 construct use the following link.
Press Tab to accept the above suggestion.
Step 6: Deploy the stack
To deploy the stack, use the below command:
1 |
cdk deploy |
You can verify the creation of your stack through CloudFormation service.
Verify the S3 Bucket’s creation in the console.
Conclusion
Code suggestions are produced by Amazon CodeWhisperer, an AI-powered productivity tool for the IDE and command line, based on comments and previously written code. It can be integrated with most of the IDE by installing the AWS Toolkit and creating an AWS Builder ID account. AWS Cloud9 IDE comes with preconfigured Amazon CodeWhisperer, which does not require setting up an AWS Builder ID Account.
Freedom Month Sale — Discounts That Set You Free!
- Up to 80% OFF AWS Courses
- Up to 30% OFF Microsoft Certs
About CloudThat
CloudThat is an award-winning company and the first in India to offer cloud training and consulting services worldwide. As a Microsoft Solutions Partner, AWS Advanced Tier Training Partner, and Google Cloud Platform Partner, CloudThat has empowered over 850,000 professionals through 600+ cloud certifications winning global recognition for its training excellence including 20 MCT Trainers in Microsoft’s Global Top 100 and an impressive 12 awards in the last 8 years. CloudThat specializes in Cloud Migration, Data Platforms, DevOps, IoT, and cutting-edge technologies like Gen AI & AI/ML. It has delivered over 500 consulting projects for 250+ organizations in 30+ countries as it continues to empower professionals and enterprises to thrive in the digital-first world.

WRITTEN BY Siddiq Pasha
Comments