Giter Club home page Giter Club logo

pulumi-java's Introduction

Pulumi Java SDK lets you leverage the full power of Pulumi Infrastructure as Code Platform using the Java programming language. Java support is currently in Public Preview.

Simply write Java code in your favorite editor and Pulumi automatically provisions and manages your AWS, Azure, Google Cloud Platform, and/or Kubernetes resources, using an infrastructure-as-code approach. Use standard language features like loops, functions, classes, and IDE features like refactorig and package management that you already know and love.

For example, create three web servers:

package myinfra;

import com.pulumi.Pulumi;
import com.pulumi.aws.ec2.Instance;
import com.pulumi.aws.ec2.InstanceArgs;
import com.pulumi.aws.ec2.SecurityGroup;
import com.pulumi.aws.ec2.SecurityGroupArgs;
import com.pulumi.aws.ec2.enums.InstanceType;
import com.pulumi.aws.ec2.inputs.SecurityGroupIngressArgs;

import java.util.List;

public final class Infra {
    public static void main(String[] args) {
        Pulumi.run(ctx -> {
            final var sg = new SecurityGroup("web-sg", SecurityGroupArgs.builder()
                    .ingress(SecurityGroupIngressArgs.builder()
                            .protocol("tcp")
                            .fromPort(80)
                            .toPort(80)
                            .cidrBlocks("0.0.0.0/0")
                            .build())
                    .build());
            for (var i = 0; i < 3; i++) {
                new Instance(String.format("web-%d", i), InstanceArgs.builder()
                        .ami("ami-7172b611")
                        .instanceType(InstanceType.T2_Micro)
                        .securityGroups(sg.name().applyValue(List::of))
                        .userData(String.join("\n",
                                "#!/bin/bash",
                                "echo \"Hello, World!\" > index.html",
                                "nohup python -m SimpleHTTPServer 80 &"))
                        .build());
            }
        });
    }
}

Welcome

  • Get Started with Pulumi using Java: Deploy a simple application in AWS, Azure, Google Cloud or Kubernetes using Pulumi to describe the desired infrastructure using Java.

  • Examples: Browse Java examples across many clouds and scenarios including containers, serverless, and infrastructure.

  • Docs: Learn about Pulumi concepts, follow user-guides, and consult the reference documentation. Java examples are included.

  • Community Slack: Join us in Pulumi Community Slack. All conversations and questions are welcome.

  • GitHub Discussions: Ask questions or share what you are building with Pulumi.

Getting Started

The following steps demonstrate how to declare your first cloud resources in a Pulumi Java, and deploy them to AWS, in minutes:

  1. Install Pulumi:

    To install the latest Pulumi release, run the following (see full installation instructions for additional installation options):

    $ curl -fsSL https://get.pulumi.com/ | sh
  2. Create a Project:

    After installing, you can get started with the pulumi new command:

    $ mkdir pulumi-java-demo && cd pulumi-java-demo
    $ pulumi new aws-java

    The new command offers templates, including Java templates, for all clouds. Run it without an argument and it'll prompt you with available projects.

  3. Deploy to the Cloud:

    Run pulumi up to get your code to the cloud:

    $ pulumi up

    This makes all cloud resources declared in your code. Simply make edits to your project, and subsequent pulumi ups will compute the minimal diff to deploy your changes.

  4. Use Your Program:

    Now that your code is deployed, you can interact with it. In the above example, we can find the name of the newly provisioned S3 bucket:

    $ pulumi stack output bucketName

To learn more, head over to pulumi.com for much more information, including tutorials, examples, and details of the core Pulumi CLI and programming model concepts.

Requirements

JDK 11 or higher is required.

Apache Maven is the recommended build tool. Gradle Build Tool is also supported. Pulumi will recognize Maven and Gradle programs and automatically recompile them without any further configuration. The supported versions are:

  • Apache Maven 3.8.4
  • Gradle Build Tool 7.4

Other build tools are supported via the runtime.options.binary configuration option that can point to a pre-built jar in Pulumi.yaml:

name: myproject
runtime:
  name: java
  options:
    binary: target/myproject-1.0-SNAPSHOT-jar-with-dependencies.jar

Contributing

Visit CONTRIBUTING.md for information on building Pulumi Java support from source or contributing improvements.

pulumi-java's People

Contributors

t0yv0 avatar pawelprazak avatar dependabot[bot] avatar zaid-ajaj avatar iwahbe avatar dixler avatar abhinav avatar aaronfriel avatar justinvp avatar mikhailshilkov avatar frassle avatar danielrbradley avatar myhau avatar pulumi-bot avatar robbiemckinstry avatar kpitzen avatar aq17 avatar maxandersen avatar sideeffffect avatar pgavlin avatar thomas11 avatar arunsathiya avatar cnunciato avatar krishnan-mani avatar lblackstone avatar tgummerer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.