Step-by-step configuration for AWS CDK with Java.
Before starting, ensure you have the following installed:
- Java 25 - Download Java or Amazon Corretto
- Maven - Maven Installation Guide
- Node.js (v18 or later) - Required for CDK CLI - Node.js Downloads
π Documentation: AWS CDK Prerequisites
If your organization uses AWS IAM Identity Center (formerly AWS SSO):
- Navigate to your AWS Access Portal URL (provided by your administrator)
- Sign in with your credentials
- Select the AWS account you want to access
- Click on "Access Keys"
- Copy the credentials from: "Option 1: Set AWS environment variables" and paste them to the terminal
π Documentation: AWS IAM Identity Center
After setting the environment variables, verify your credentials:
aws sts get-caller-identityExpected output:
{
"UserId": "AIDAXXXXXXXXXXXXXXXXX",
"Account": "123456789012",
"Arn": "arn:aws:iam::123456789012:user/your-username"
}On macOS using Homebrew:
brew install awscliVerify installation:
aws --versionExpected output: aws-cli/2.x.x ...
π Documentation: Installing AWS CLI
Install CDK CLI globally using npm:
npm install -g aws-cdkVerify installation:
cdk --versionExpected output: 2.x.x (build ...)
π Documentation: Installing AWS CDK
Paste the credentials into the terminal before running the commands below.
Bootstrap your AWS environment for CDK deployments. This creates necessary resources (S3 bucket, IAM roles) in your AWS account:
cdk bootstrap aws://ACCOUNT-NUMBER/REGIONExample:
cdk bootstrap aws://123456789012/us-east-1Or let CDK determine your account and region automatically:
cdk bootstrapExpected output:
β³ Bootstrapping environment aws://123456789012/us-east-1...
β
Environment aws://123456789012/us-east-1 bootstrapped.
What does bootstrap create?
- S3 bucket for storing CDK assets (Lambda code, Docker images)
- IAM roles for CloudFormation deployments
- ECR repository for container images (if needed)
π Documentation: Bootstrapping CDK
Verify your setup by deploying a working example project:
git clone https://github.com/AdamBien/aws-quarkus-lambda-function-url-cdk-plain.git
cd aws-quarkus-lambda-function-url-cdk-plainFollow the deployment instructions in that repository to confirm your environment is properly configured.
π Documentation: Deploying CDK Applications