[0:00]Hello, my name is Joe and I'm a solutions architect here at AWS. I've been working on the AWS CDK for quite some time now, and I'm really excited to share with you some of the features that make the CDK a really powerful tool for defining your cloud infrastructure. In this demo, we'll be taking a look at how to deploy a serverless application using the AWS CDK and Python. We'll be walking through how to define your resources in Python, how to synthesize that into a cloud formation template, and then how to deploy that into your AWS account. And then finally, we'll take a look at how to tear down those resources using the AWS CDK as well. If you have any questions along the way, please feel free to reach out to me or any of the other solutions architects here at AWS. We're always happy to help. So, what exactly is the AWS CDK? The AWS CDK is a software development framework for defining your cloud infrastructure in code. It's a way to define your resources using familiar programming languages like Python, TypeScript, Java, and C#. This allows you to leverage the power of those programming languages to define your infrastructure in a much more expressive and programmatic way. So, instead of defining your infrastructure in a YAML or JSON template, you can define it in Python, which allows you to use things like loops, conditionals, and functions to define your infrastructure in a much more modular and reusable way. The AWS CDK also provides you with a set of constructs, which are basically pre-built modules that allow you to define your infrastructure at a higher level of abstraction. So, instead of defining an S3 bucket with all of its properties, you can simply say, I want an S3 bucket. And the CDK will take care of all the underlying details for you. This allows you to define your infrastructure in a much more concise and readable way, and it also allows you to focus on the business logic of your application rather than the underlying infrastructure details. So, let's take a look at a quick example of how to define a simple S3 bucket using the AWS CDK and Python. So, as you can see here, we have a very simple Python script that defines an S3 bucket. We're importing the S3 module from the AWS CDK, and then we're creating a new S3 bucket with a given name. And that's all there is to it. Once you've defined your S3 bucket, you can then synthesize that into a cloud formation template using the CDK CLI. And then you can deploy that into your AWS account. So, let's take a look at how to do that now. So, as you can see here, we're using the CDK CLI to synthesize our cloud formation template. And as you can see, it's generated a cloud formation template for us, which defines our S3 bucket. And then we can use the CDK deploy command to deploy that into our AWS account. And as you can see here, it's now deploying our S3 bucket into our AWS account. And once that's complete, we'll be able to see our S3 bucket in the AWS console. And as you can see here, our S3 bucket has been successfully deployed. And we can now see it in the AWS console. And then finally, we can use the CDK destroy command to tear down our S3 bucket. And as you can see here, it's now tearing down our S3 bucket. And once that's complete, we'll be able to see that our S3 bucket has been removed from our AWS account. So, that's a quick overview of how to use the AWS CDK to deploy a simple S3 bucket. In the next section, we'll be taking a look at how to deploy a serverless application using the AWS CDK and Python. So, let's take a look at the architecture of our serverless application. Our serverless application will consist of an API gateway endpoint, which will trigger a Lambda function, which will then interact with a DynamoDB table. So, let's take a look at how to define these resources using the AWS CDK and Python. So, as you can see here, we have a Python script that defines our serverless application. We're importing the API gateway, Lambda, and DynamoDB modules from the AWS CDK, and then we're creating a new DynamoDB table with a given name and primary key. And then we're creating a new Lambda function with a given name, handler, and runtime. And then finally, we're creating a new API gateway endpoint that triggers our Lambda function. And then we're granting our Lambda function permissions to read and write to our DynamoDB table. And that's all there is to it. Once you've defined your serverless application, you can then synthesize that into a cloud formation template using the CDK CLI. And then you can deploy that into your AWS account. So, let's take a look at how to do that now. So, as you can see here, we're using the CDK CLI to synthesize our cloud formation template. And as you can see, it's generated a cloud formation template for us, which defines our serverless application. And then we can use the CDK deploy command to deploy that into our AWS account. And as you can see here, it's now deploying our serverless application into our AWS account. And once that's complete, we'll be able to test our serverless application. And as you can see here, our serverless application has been successfully deployed. And we can now test it using our API gateway endpoint. So, let's take a look at how to do that now. So, as you can see here, we're making a request to our API gateway endpoint, which is triggering our Lambda function, which is then interacting with our DynamoDB table. And as you can see, we're getting a successful response from our serverless application. So, that's a quick overview of how to use the AWS CDK to deploy a serverless application. In this demo, we've taken a look at how to define your resources in Python, how to synthesize that into a cloud formation template, and then how to deploy that into your AWS account. And then finally, we've taken a look at how to tear down those resources using the AWS CDK as well. If you have any questions along the way, please feel free to reach out to me or any of the other solutions architects here at AWS. We're always happy to help. Thank you for watching.
Watch on YouTube
Share
MORE TRANSCRIPTS



