Install CDK4J Maven plugin

Install CDK4J Maven plugin

You install the CDK4J maven plugin by adding the following snippet to your maven pom.xml

<plugin>
  <groupId>org.datapith</groupId>
  <artifactId>cdk4j-maven-plugin</artifactId>
  <version>@project.version@</version>
  <configuration>
    <!-- Full class name of the app class defining your stacks -->
    <app>org.datapith.examples.GettingStartedApp</app>
  </configuration>
  <executions>
    <execution>
      <id>deploy-cdk-app</id>
      <phase>deploy</phase>
      <goals>
        <goal>synth</goal>
        <goal>bootstrap</goal>
        <goal>deploy</goal>
      </goals>
    </execution>
  </executions>
</plugin>

To have the CDK4J maven plugin interact with AWS, you must configure security credentials on your local machine. This lets AWS know who you are and what permissions you have.

The system’s environment variables used are:

  • AWS_ACCESS_KEY_ID - Specifies an AWS access key associated with an IAM account.
  • AWS_SECRET_ACCESS_KEY - Specifies the secret key associated with the access key. This is essentially the “password” for the access key.
  • AWS_REGION - The AWS SDK compatible environment variable that specifies the AWS Region to send the request to.