Skip to content

Commit 8121ceb

Browse files
authored
Java 1.0 Blog Post (#13953)
Blog post for Java 1.0 announcement
1 parent 579c797 commit 8121ceb

File tree

4 files changed

+182
-0
lines changed

4 files changed

+182
-0
lines changed

content/blog/java-1-0/index.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
title: "Pulumi Java is Now Generally Available"
3+
date: 2025-02-10T16:15:00-08:00
4+
draft: false
5+
6+
meta_desc: "The Pulumi Java SDK is now generally available. It enables organizations of all sizes to build infrastructure using a proven, safe, and familiar language."
7+
meta_image: meta.png
8+
9+
authors:
10+
- mark-huber
11+
- justin-vanpatten
12+
tags:
13+
- java
14+
- features
15+
- releases
16+
17+
social:
18+
twitter: "☕ The Pulumi Java SDK is now Generally Available! Manage your infrastructure using the composable, strongly typed programming language you already know and love - now including the powerful Pulumi Automation API!"
19+
linkedin: "Java, the world’s most trusted enterprise programming language, is now generally available in Pulumi. You can now leverage Java’s familiar, expressive, and safe syntax to manage your infrastructure in a composable and scalable way.
20+
21+
Learn more about automating everything you run in the cloud with Java: [Link]"
22+
---
23+
24+
One of Pulumi's core Infrastructure as Code (IaC) features is the ability to [model infrastructure](https://www.pulumi.com/docs/iac/concepts/) using well-traveled, familiar general-purpose programming languages. Today, we're thrilled to announce that Java, one of the world's most popular programming languages, is now generally available in Pulumi. This release joins our existing first-class support for TypeScript, Python, Go, YAML, and C#, enabling Java developers to manage cloud infrastructure using the language they know and trust.
25+
26+
<!--more-->
27+
28+
We’ve grown our Java support based on feedback from the expanding set of companies that have adopted Pulumi Java in production workloads. Let’s look at some examples of using Java to power your Pulumi programs.
29+
30+
## Familiar Composability
31+
32+
Using Java with Pulumi lets you model your infrastructure using familiar patterns. Paired with rich abstractions, you can efficiently build Pulumi programs. It only seems appropriate that we take a look at a Java example using Oracle Cloud:
33+
34+
1. We start our program by grabbing our [configuration](https://www.pulumi.com/docs/iac/concepts/config/) values that describe which distro and AD to use.
35+
36+
```java
37+
var config = ctx.config();
38+
var compartmentId = config.require("compartmentId");
39+
var availabilityDomain = config.require("availabilityDomain");
40+
var ubuntuId = config.require("ubuntuId");
41+
```
42+
43+
2. Next, we create a set of abstractions to describe the networking and OS.
44+
45+
```java
46+
var vcn = new VirtualNetwork("virtualNetworkResource", VirtualNetworkArgs.builder()
47+
.compartmentId(compartmentId)
48+
.cidrBlock("10.0.0.0/16")
49+
.build());
50+
51+
var subnet = new Subnet("testSubnet", SubnetArgs.builder()
52+
.cidrBlock("10.0.0.0/24")
53+
.compartmentId(compartmentId)
54+
.vcnId(vcn.id())
55+
.availabilityDomain(availabilityDomain)
56+
.build());
57+
58+
var vnicDetails = InstanceCreateVnicDetailsArgs.builder()
59+
.subnetId(subnet.id())
60+
.assignPublicIp("true")
61+
.build();
62+
63+
var sourceDetails = InstanceSourceDetailsArgs.builder()
64+
.sourceType("image")
65+
.sourceId(ubuntuId)
66+
.build();
67+
```
68+
69+
3. Finally, we compose our instance.
70+
71+
```java
72+
var instance = new Instance("instanceResource", InstanceArgs.builder()
73+
.availabilityDomain(availabilityDomain)
74+
.compartmentId(compartmentId)
75+
.shape("VM.Standard.E2.1.Micro")
76+
.preserveBootVolume(false)
77+
.createVnicDetails(vnicDetails)
78+
.sourceDetails(sourceDetails)
79+
.build());
80+
```
81+
82+
With just a few lines of code (especially by Java standards), we composed a set of strongly typed, easy-to-reason about resources using the builder pattern (a Java favorite) and without introducing any new language paradigms.
83+
84+
## New: Java Automation API
85+
86+
With the general availability of our Java language support, we’re also excited to announce that the [Automation API](https://www.pulumi.com/docs/iac/using-pulumi/automation-api/) is now supported in Java. The Automation API is a fully typed SDK that allows you to interact with Pulumi programs outside the Pulumi CLI. You can directly access and orchestrate your Pulumi projects and stacks with the SDK, allowing you to supercharge your Infrastructure as Code.
87+
88+
In our Automation API [examples repo](https://github.com/pulumi/automation-api-examples), we have an example demonstrating how you could construct a Pulumi program with the Automation API to [perform a database migration](https://github.com/pulumi/automation-api-examples/tree/main/java/databaseMigration). Let's take a look at a few of the interesting aspects:
89+
90+
1. Like regular Pulumi programs, we're able to obtain the current operating context and use the details to construct new resources, inline with the rest of the Automation API program.
91+
92+
```java
93+
Consumer<Context> program = ctx -> {
94+
...
95+
96+
var subnetGroup = new SubnetGroup("db-subnet", ...);
97+
98+
// Make a public security group for our cluster for the migration
99+
var securityGroup = new SecurityGroup("public-security-group", ...);
100+
101+
// Example values for our db
102+
var dbName = "hellosql";
103+
var dbUser = "hellosql";
104+
var dbPassword = "hellosql";
105+
106+
// Provision our db
107+
var cluster = new Cluster("db", ClusterArgs.builder()
108+
.engine(EngineType.AuroraMysql)
109+
.engineVersion("8.0.mysql_aurora.3.08.0")
110+
.databaseName(dbName)
111+
.masterUsername(dbUser)
112+
.masterPassword(dbPassword)
113+
.skipFinalSnapshot(true)
114+
.dbSubnetGroupName(subnetGroup.name())
115+
.vpcSecurityGroupIds(securityGroup.id().applyValue(List::of))
116+
.build());
117+
118+
var clusterInstance = new ClusterInstance("db-instance", ClusterInstanceArgs.builder()
119+
.clusterIdentifier(cluster.clusterIdentifier())
120+
.instanceClass("db.t3.medium")
121+
.engine(EngineType.AuroraMysql.getValue())
122+
.engineVersion("8.0.mysql_aurora.3.08.0")
123+
.publiclyAccessible(true)
124+
.dbSubnetGroupName(subnetGroup.name())
125+
.build());
126+
127+
ctx.export("host", cluster.endpoint());
128+
ctx.export("db_name", dbName);
129+
ctx.export("db_user", dbUser);
130+
ctx.export("db_pass", dbPassword);
131+
};
132+
```
133+
134+
2. With the Automation API, however, we're also able to directly interact with project and stack objects, giving us the opportunity to orchestrate workflows. This could include scaffolding
135+
projects, working across stacks, or in our case, completing a one-time workflow to migrate a database.
136+
137+
```java
138+
var projectName = "database_migration_project";
139+
var stackName = "dev";
140+
141+
try (var stack = LocalWorkspace.createOrSelectStack(projectName, stackName, program)) {
142+
...
143+
144+
stack.workspace().installPlugin("aws", "v6.68.0");
145+
146+
stack.setConfig("aws:region", new ConfigValue("us-west-2"));
147+
148+
System.out.println("updating stack...");
149+
var result = stack.up(UpOptions.builder()
150+
.onStandardOutput(System.out::println)
151+
.build());
152+
153+
var changes = result.summary().resourceChanges();
154+
if (!changes.isEmpty()) {
155+
System.out.println("update summary:");
156+
changes.forEach((key, value) -> {
157+
System.out.printf(" %s: %d%n", key, value);
158+
});
159+
}
160+
161+
System.out.printf("db host url: %s%n", result.outputs().get("host").value());
162+
configureDatabase(
163+
...
164+
);
165+
}
166+
```
167+
168+
The full example, along with others, is available in our Automation API [examples repo](https://github.com/pulumi/automation-api-examples/tree/main/java). We're excited to bring the Automation API to the [Java SDK](https://www.pulumi.com/docs/iac/languages-sdks/java/) for the first time and we're looking forward to your feedback.
169+
170+
## Get Started with Pulumi Java
171+
172+
To learn more about and to get started with Pulumi Java, you can check out the following resources:
173+
174+
* [Java SDK Repo](https://github.com/pulumi/pulumi-java): The Java SDK is fully open-source, and we’re excited to get your feedback or review any pull requests.
175+
176+
* [Examples Repo](https://github.com/pulumi/examples): The Pulumi examples repo has many examples of Pulumi Java programs to help you get up and running with Pulumi Java.
177+
178+
* [Pulumi Java Converter](https://www.pulumi.com/docs/iac/adopting-pulumi/converters/): The Pulumi converter tool efficiently migrates existing IaC applications, such as Terraform, ARM, and Bicep, to Pulumi Java.

content/blog/java-1-0/meta.png

517 KB
Loading

data/team/team/mark-huber.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
id = "mark-huber"
2+
name = "Mark Huber"
3+
title = "Product Manager"
4+
status = "active"

static/images/team/mark-huber.jpg

36.6 KB
Loading

0 commit comments

Comments
 (0)