AWS

5 Mins Read

Build S3 Bucket with AWS Code Whisperer and AWS CDK

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.

Customized Cloud Solutions to Drive your Business Success

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More

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.

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.

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.

 

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:

 

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:

 

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.

AWS S3 Construct Library

Press Tab to accept the above suggestion.

Step 6: Deploy the stack

To deploy the stack, use the below command:

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.

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training PartnerAWS Migration PartnerAWS Data and Analytics PartnerAWS DevOps Competency PartnerAWS GenAI Competency PartnerAmazon QuickSight Service Delivery PartnerAmazon EKS Service Delivery Partner AWS Microsoft Workload PartnersAmazon EC2 Service Delivery PartnerAmazon ECS Service Delivery PartnerAWS Glue Service Delivery PartnerAmazon Redshift Service Delivery PartnerAWS Control Tower Service Delivery PartnerAWS WAF Service Delivery Partner and many more.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings

WRITTEN BY Siddiq Pasha

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!