Instructor: 0:00 Let's take a quick look at our CDK project. As we can see there are lots of things that were created and configured for us. There are two important files here.
0:07 First up, there's been to-do app JS which is the entry point of our AWS CDK application. This is going to import the to-do app stack from inaudible to-do app stack. This is where we're going to spend the most of our time in because this is where our stack is defined.
0:21 Basically, CDK apps are effectively a definition of your infrastructure using code. What kind of infrastructure? This is up to us. The other thing that we actually have to import in each CDK stack is this line. Import CDK from CDK core.
0:35 This contains core CDK, the parenthesis such as CDK stack, CDK constructs and so on. The rest of them depends on what kind of things that we want to ship into AWS. For instance, this sample app is using SQS. SQS stands for Simple Queue Service and also an SNS topic. SNS stands for Simple Notification Service.
0:54 For the record, you don't need to necessarily know what those are because we are not going to use either SQS and SNS in this course.
1:01 What is important to highlight here is that both SQS queue and SNS topics are instances of something that is called a construct. According to the official documentation, constructs are the basic building blocks of AWS CDK apps. A contract represents a cloud component and encapsulates everything AWS CloudFormation needs to create the component.
1:20 What that means is that a contract can represent a single resource such as Amazon Simple Storage Service bucket. As an example, we can see that over here, this SNS topic is a construct, because it's going to represent a single resource in AWS which in this case is a topic.
1:34 Also, a construct can represent a higher level component consisting of multiple CDK resources. For instance, we can define an entire infrastructure of an app as a single construct. and you can both publish those constructs, for instance, to NPM.
1:47 Also, use constructs that were created by somebody else in the community to make your work easier and avoid reinventing the wheel. With that being said, let us build and deploy our stock to AWS. To do that around NPM, around wat in order to start the TypeScript compiler next up in the second terminal window, we are going to run CDK diff.
2:04 CDK diff is a command that shows us the difference between the stack that we already have deployed to AWS and the stack that we are about to deploy.
2:11 Since we don't have anything deployed to AWS right now, this is going to show everything that we are about to deploy. As you can see, there are quite a few things highlighted here in this output. The most important ones are those resources.
2:23 As you can see over here that we are about to deploy the SQS queue, which is defined over here, and also a SNS topic, which is also defined over here in our code. This is also kind of important to highlight that there's so many things that are already configured for us in a diverse code and we don't necessarily have to care about those.
2:40 What we do care about is defining can infrastructure that we want to ship into AWS and CDK is going to do the heavy lifting for us in order to shift this infrastructure to AWS around CDK deploy.
2:51 Basically, the time that we are about deploy potentially is sensitive changes to AWS, it's going to ask us for a confirmation. Right now, CDK is asking us whether we are OK adding the substitution to an SNS topic. We are more than OK with that.
3:02 I'm going to press yes and continue deploying those changes. After about 20 seconds, we see a confirmation over her that our to-do apps has been successfully deployed to AWS cloud.