You can create an AWS CDK project entirely on the command. In this lesson, you will learn how to install the AWS CLI to view all of you existing S3 bucks and to initialize a CDK app with TypeScript.
You can find the CLI documentation here at Configuring the AWS CLI
Tomasz Łakomy: [0:00] Before we start, let's make sure that we have the newest version of CDK installed. In order to do that, I'm going to run npm install aws-cdk. To make sure that CDK was successfully installed, I'm going to run cdk --version. Nice.
[0:15] Another thing that we need to do is to make sure that our AWS command line interface has been configured properly. If you don't know how to do this, I recommend checking out this page from AWS documentation. A link to that is in the description to this video. For instance, I can run aws s3 ls, in order to list all S3 buckets in my account, including half-life-3-source-code.
[0:37] Now, with everything prepared, I can go ahead, clear all of that, and create a folder for our project. This project is going to be a bookstore app. I'm going to call it book-store-graphql-api. If I go to this directory, now I can run cdk init app --language, and we're going to choose typescript for this project.
[0:58] This is going to take a second and boot start our entire CDK project for us. Nice. All done. Let me go ahead and open up my Visual Studio Code editor, and we can see all the files that CDK has generated for us. For instance, if you go to lib directory, here we can see our empty stack.
This course is written using version 1 of the cdk, while at the time of writting this comment, we are on version 2. If you get stuck, you can refer to this modified code: import * as cdk from 'aws-cdk-lib'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import { Construct } from 'constructs'; import * as appsync from '@aws-cdk/aws-appsync-alpha';
export class BookStoreGraphqlApiStack extends cdk.Stack { constructor(scope: Construct, id: string, props?: cdk.StackProps) { super(scope, id, props);
} }