2022-05-03 21:23:32 -07:00

22 KiB
Raw Permalink Blame History

title, meta_desc, type, layout, overview, details, benefits, case_studies, get_started
title meta_desc type layout overview details benefits case_studies get_started
Pulumi Packages Pulumi Packages give you the tools to easily build and deploy cloud infrastructure with TypeScript/JavaScript, Python, Go, and C#. page product-packages
title description
Build and reuse cloud infrastructure as code Pulumi Packages give you the building blocks to easily build and deploy cloud infrastructure with TypeScript/JavaScript, Python, Go, and C#. Provision resources from the top clouds and SaaS providers to build cloud infrastructure that meets your needs. For popular architectures like Kubernetes or serverless, use Pulumi components to get to production faster than ever.
title providers components
A package for every cloud and architecture
title description ide
Providers give you direct access to cloud resources Use over 60 providers to build your infrastructure from scratch with cloud and SaaS integrations. Pulumi Native Providers give you the most comprehensive resource coverage of AWS, Azure, Google Cloud, and Kubernetes with same-day access to new features.
title language code
index.ts typescript import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; // Get the id for the latest Amazon Linux AMI const ami = aws.ec2.getAmi({ filters: [ { name: "name", values: ["amzn-ami-hvm-*-x86_64-ebs"] }, ], owners: ["137112412989"], // Amazon mostRecent: true, }).then(result => result.id); // create a new security group for port 80 const group = new aws.ec2.SecurityGroup("web-secgrp", { ingress: [ { protocol: "tcp", fromPort: 80, toPort: 80, cidrBlocks: ["0.0.0.0/0"] }, ], }); const server = new aws.ec2.Instance("web-server-www", { tags: { "Name": "web-server-www" }, instanceType: aws.ec2.InstanceType.T2_Micro, // t2.micro is available in the AWS free tier vpcSecurityGroupIds: [ group.id ], // reference the group object above ami: ami, }); export const publicIp = server.publicIp; export const publicHostName = server.publicDns;
title language code
__main__.py python import pulumi import pulumi_aws as aws size = 't2.micro' ami = aws.ec2.get_ami(most_recent=True, owners=["137112412989"], filters=[aws.GetAmiFilterArgs(name="name", values=["amzn-ami-hvm-*"])]) group = aws.ec2.SecurityGroup('web-secgrp', description='Enable HTTP access', ingress=[aws.ec2.SecurityGroupIngressArgs( protocol='tcp', from_port=80, to_port=80, cidr_blocks=['0.0.0.0/0'], )]) server = aws.ec2.Instance('web-server-www', instance_type=size, vpc_security_group_ids=[group.id], ami=ami.id) pulumi.export('public_ip', server.public_ip) pulumi.export('public_dns', server.public_dns)
title language code
main.go go package main import ( "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { // Create a new security group for port 80. group, err := ec2.NewSecurityGroup(ctx, "web-secgrp", &ec2.SecurityGroupArgs{ Ingress: ec2.SecurityGroupIngressArray{ ec2.SecurityGroupIngressArgs{ Protocol: pulumi.String("tcp"), FromPort: pulumi.Int(80), ToPort: pulumi.Int(80), CidrBlocks: pulumi.StringArray{pulumi.String("0.0.0.0/0")}, }, }, }) if err != nil { return err } // Get the ID for the latest Amazon Linux AMI. mostRecent := true ami, err := ec2.LookupAmi(ctx, &ec2.LookupAmiArgs{ Filters: []ec2.GetAmiFilter{ { Name: "name", Values: []string{"amzn-ami-hvm-*-x86_64-ebs"}, }, }, Owners: []string{"137112412989"}, MostRecent: &mostRecent, }) if err != nil { return err } // Create a simple web server using the startup script for the instance. srv, err := ec2.NewInstance(ctx, "web-server-www", &ec2.InstanceArgs{ Tags: pulumi.StringMap{"Name": pulumi.String("web-server-www")}, InstanceType: pulumi.String("t2.micro"), // t2.micro is available in the AWS free tier. VpcSecurityGroupIds: pulumi.StringArray{group.ID()}, Ami: pulumi.String(ami.Id), }) // Export the resulting server's IP address and DNS name. ctx.Export("publicIp", srv.PublicIp) ctx.Export("publicHostName", srv.PublicDns) return nil }) }
title language code
MyStack.cs csharp using Pulumi; using Pulumi.Aws; using Pulumi.Aws.Ec2; using Pulumi.Aws.Ec2.Inputs; using Pulumi.Aws.Inputs; class WebServerStack : Stack { public WebServerStack() { var ami = Output.Create(Pulumi.Aws.Ec2.GetAmi.InvokeAsync(new Pulumi.Aws.Ec2.GetAmiArgs { MostRecent = true, Owners = {"137112412989"}, Filters = {new Pulumi.Aws.Ec2.Inputs.GetAmiFilterArgs {Name = "name", Values = {"amzn-ami-hvm-*"}}} })); var group = new SecurityGroup("web-secgrp", new SecurityGroupArgs { Description = "Enable HTTP access", Ingress = { new SecurityGroupIngressArgs { Protocol = "tcp", FromPort = 80, ToPort = 80, CidrBlocks = {"0.0.0.0/0"} } } }); var server = new Instance("web-server-www", new InstanceArgs { InstanceType = Size, VpcSecurityGroupIds = {group.Id}, Ami = ami.Apply(a => a.Id) }); this.PublicIp = server.PublicIp; this.PublicDns = server.PublicDns; } [Output] public Output<string> PublicIp { get; set; } [Output] public Output<string> PublicDns { get; set; } private const string Size = "t2.micro"; }
title language code
Main.Java java package webserver; import com.pulumi.Context; import com.pulumi.Exports; import com.pulumi.Pulumi; import com.pulumi.aws.ec2.Ec2Functions; 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.inputs.GetAmiArgs; import com.pulumi.aws.ec2.inputs.GetAmiFilter; import com.pulumi.aws.ec2.inputs.SecurityGroupIngressArgs; import com.pulumi.aws.ec2.outputs.GetAmiResult; import com.pulumi.core.Output; import java.util.List; import java.util.Map; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static Exports stack(Context ctx) { final var ami = Ec2Functions.getAmi(GetAmiArgs.builder() .filters(new GetAmiFilter("name", List.of("amzn-ami-hvm-*-x86_64-ebs"))) .owners("137112412989") .mostRecent(true) .build() ).thenApply(GetAmiResult::id); final var group = new SecurityGroup("web-secgrp", SecurityGroupArgs.builder() .ingress(SecurityGroupIngressArgs.builder() .protocol("tcp") .fromPort(80) .toPort(80) .cidrBlocks("0.0.0.0/0") .build()) .build() ); // (optional) create a simple web server using the startup // script for the instance final var userData = "#!/bin/bash\n" + "echo "Hello, World!" > index.html\n" + "nohup python -m SimpleHTTPServer 80 &"; final var server = new Instance("web-server-www", InstanceArgs.builder() .tags(Map.of("Name", "web-server-www")) .instanceType(Output.ofRight(com.pulumi.aws.ec2.enums.InstanceType.T2_Micro)) .vpcSecurityGroupIds(group.getId().applyValue(List::of)) .ami(Output.of(ami)) .userData(userData) .build() ); ctx.export("publicIp", server.publicIp()); ctx.export("publicHostName", server.publicDns()); return ctx.exports(); } }
title language code
Pulumi.yaml yaml name: webserver runtime: yaml description: Basic example of an AWS web server accessible over HTTP configuration: InstanceType: type: String default: t3.micro variables: ec2ami: Fn::Invoke: Function: aws:getAmi Arguments: filters: - name: name values: ["amzn-ami-hvm-*-x86_64-ebs"] owners: ["137112412989"] mostRecent: true Return: id resources: WebSecGrp: type: aws:ec2:SecurityGroup properties: ingress: - protocol: tcp fromPort: 80 toPort: 80 cidrBlocks: ["0.0.0.0/0"] WebServer: type: aws:ec2:Instance properties: instanceType: ${InstanceType} ami: ${ec2ami} userData: |- #!/bin/bash echo 'Hello, World from ${WebSecGrp.arn}!' > index.html nohup python -m SimpleHTTPServer 80 & vpcSecurityGroupIds: - ${WebSecGrp} outputs: PublicIp: ${WebServer.publicIp} PublicHostName: ${WebServer.publicDns}
title description ide
Components give you production-ready cloud architectures Build production-quality cloud architectures faster and smarter with components. These higher-level building blocks come with best practices and sensible defaults built in so you can spend less time on configuration and more time on building applications.
title language code
index.ts typescript import * as eks from "@pulumi/eks"; // Create an EKS cluster. const cluster = new eks.Cluster("cluster", { instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 2, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig;
title language code
__main__.py python import pulumi import pulumi_eks as eks # Create an EKS cluster. cluster = eks.Cluster( "cluster", instance_type="t2.medium", desired_capacity=2, min_size=1, max_size=2, ) # Export the cluster's kubeconfig. pulumi.export("kubeconfig", cluster.kubeconfig)
title language code
main.go go package main import ( "github.com/pulumi/pulumi-eks/sdk/go/eks/cluster" "github.com/pulumi/pulumi/sdk/v2/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { // Create an EKS cluster. cluster, err := cluster.NewCluster(ctx, "cluster", cluster.ClusterArgs{ InstanceType: pulumi.String("t2.medium"), DesiredCapacity: pulumi.Int(2), MinSize: pulumi.Int(1), MaxSize: pulumi.Int(2), }, ) if err != nil { return err } // Export the cluster's kubeconfig. ctx.Export("kubeconfig", cluster.Kubeconfig) return nil }) }
title language code
MyStack.cs csharp using System; using System.Threading.Tasks; using Pulumi; using Pulumi.Eks.Cluster; class EksStack : Stack { public EksStack() { // Create an EKS cluster. var cluster = new Cluster("cluster", new ClusterArgs { InstanceType = "t2.medium", DesiredCapacity = 2, MinSize = 1, MaxSize = 2, }); // Export the cluster's kubeconfig. this.Kubeconfig = cluster.Kubeconfig; } [Output("kubeconfig")] public Output<string> Kubeconfig { get; set; } } class Program { static Task<int> Main(string[] args) => Deployment.RunAsync<EksStack>(); }
title language code
Main.java java package com.pulumi.example.eks; import com.pulumi.Context; import com.pulumi.Exports; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.eks.Cluster; import com.pulumi.eks.ClusterArgs; import java.util.stream.Collectors; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } private static Exports stack(Context ctx) { var cluster = new Cluster("my-cluster", ClusterArgs.builder() .instanceType("t2.micro") .desiredCapacity(2) .minSize(1) .maxSize(2) .build()); ctx.export("kubeconfig", cluster.kubeconfig()); return ctx.exports(); } }
title language code
Pulumi.yaml yaml name: aws-eks runtime: yaml description: An EKS cluster resources: cluster: type: eks:Cluster properties: instanceType: "t2.medium" desiredCapacity: 2 minSize: 1 maxSize: 2 outputs: kubeconfig: ${cluster.kubeconfig}
title items
Benefits
title icon icon_color description
Use your favorite languages code salmon Start building infrastructure just by installing a Go module or a NuGet, npm, or Python package. Create your own packages in every language by authoring in just one language.
title icon icon_color description
Get started faster rocketship violet Find everything you need in each package to start building cloud infrastructure and applications, including SDKs, how-to guides, and API references with hundreds of examples.
title icon icon_color description
Build faster and smarter guage purple Dont reinvent the wheel. Use or create infrastructure abstractions that encapsulate cloud architectures and best practices with Pulumi components in your favorite languages.
title icon icon_color description
Share and track infrastructure code collab blue Distribute your infrastructure code through package managers and artifactories. Share and reuse code with versioning, dependency management, and auditing.
title items
Case Studies
company name name_title link quote
lemonade Igor Shapiro Principal Engineer at Lemonade /case-studies/lemonade Pulumi supercharged our infrastructure team by helping us create reusable building blocks that developers can leverage... This empowered our developer teams to self-provision resources and ship new capabilities faster without having to wait for the infrastructure team to deploy new resources on their behalf.
company name name_title link quote
skai Danny Zalkind DevOps Group Manager at Skai /blog/kenshoo-migrates-to-aws-with-pulumi A key benefit of Pulumi is that it allows us to modularize our cloud infrastructure as reusable Python components that enable our developer teams to build faster and more independently.
company name name_title link quote
panther-labs Austin Byers Principal Platform Engineer at Panther Labs /case-studies/panther-labs Our developers needed a robust platform for managing our complex infrastructure, and it needed to be fast, modular, and testable. We now have more reliable releases and a significantly better developer experience as a result of adopting Pulumi.
title browse publish
Getting started
title cta_text description
Browse all Packages in the Registry Go to the registry View the API docs and examples of all the supported providers and components in the Pulumi ecosystem.
title cta_text description
Build Your Own Packages Read the docs Learn how to get started building and publishing your own Pulumi Packages.