How Java Developers Publish Their Lambda Functions With AWS CDK

We will talk about aws cdk on this article. It is really important service for cloud developers because it is hard to manage all services in the aws but with the aws cdk development teams can easily configure their services.

What is AWS CDK

AWS cloud development kit is a framework that is used for defining cloud infrastructure in code. It is based on Infrastructure as Code (IAC) standards that enable developers to maintain their cloud infrastructure in a repeatable and predictable manner.

Create The App

In this part we will talk about how to create our first app and AWS CDK Toolkit command-line tool.

You can easily init your first project with cdk init command. On this stage we have 2 classes. One of them is “HelloCdkApp” that is our main entry point. The other one is “HelloCdkStack” that contains our service stack. We will define our services stack on this class.

Let’s create our lambda function. First create folder and hello.js file.

We will add some maven dependencies for apigateway, lambda and s3.

Let’s update our “HelloCdkApp” class.

after adding the method run the following commands;

Let’s check our AWS services. The first one is ApiGateway

The second one is Lamda

The last one is S3

On the final we will destroy our stack. Because it is unnecasatiy for us.

For full code please visit my github.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store