I don’t have template parameters to pass here, but they can be used by SAM or AWS CloudFormation to customize the behavior of a template for different environments.
The SAM CLI automatically creates unique names for each build. You can reuse the bucket for multiple deployments. The new bucket is automatically created in the AWS Region I selected before.
I choose to create a new AWS CloudFormation stack, but you can use the same deployment option to update an existing stack. I create an S3 bucket to host the deployment packages that the build process creates. AWS SAM is using AWS CloudFormation to create and update the required resources. Right-clicking the template.yaml file I choose to Deploy Serverless Application. Code, because the Handler property of the function is specifying the source file and the method that is invoked by the Lambda platform.Infrastructure, in this case a Lambda function, API, permissions, and so on.This template is using AWS SAM to describe the deployment in terms of: To do so, I select the template.yaml file in the root directory. I deploy the serverless application in the AWS Region of my choice. I finally resume the program execution to get a similar result as before.Įverything works as expected, I am ready to go in production. There I Step Over a few times to see how the location is taken from the public website. I click Step Into to go in the getPageContents method. I can now use the IntelliJ debugger to get a better understanding of my function. I select the option to debug locally, by clicking the gutter icon. I’m not really sure how the location, part of the output message, is computed by this application, so I add a breakpoint where the pageContents variable is given a value. The local invocation of the function is using Docker containers to emulate the Lambda environment. The Run tab, where I can check the output of my function.The Build tab, using the SAM CLI to do the build.I can also pass environment variables to customize the behavior of the function. I can customize the HTTP request using the syntax described here. I select the API Gateway AWS Proxy to simulate an invocation by API Gateway. The first time I run the function, I can edit the configuration to choose the AWS credentials I want to use, the Region (for AWS services used by the function), and the input event to provide. Let’s update the assertion to make the test pass.īack to the function, I click Lambda icon on the left of the class definition to see the option to run the function locally or have a local step-through debugging session. The default application comes with unit tests that make it easy to build high-quality applications.
I open the code in the src/main/java/helloworld directory and change the message to be “Hello World from IntelliJ”. The default application is composed of a single Lambda function that you can call via HTTP using Amazon API Gateway. I have to select it and right click to add it as a Maven project.īefore I start deploying the application, I choose the AWS Region from the bottom-right menu. I’m using Maven to manage the project and the Project Object Model (pom.xml) file is not in the root directory. In the next window, I choose a name for my project and finish. Now that the IDE is configured and ready, I create a new project, select AWS on the left, and then choose AWS Serverless Application. Then restart the IDE for the changes to take effect.īuilding a serverless application with IntelliJ
In the Settings/Preferences dialog, click on Plugins, select Marketplace, search for “AWS Toolkit”, and click the Install button. Next, install the AWS Toolkit for IntelliJ via the JetBrains plugins repository. This toolkit also uses SAM CLI to build and create deployment packages for your applications. You can find installation instructions for your system here. It provides a Lambda-like execution environment and enables you to step-through and debug your code.
Last year at re:Invent we told you that we were working on the AWS Toolkit for IntelliJ.