2022-05-03 21:23:32 -07:00
---
2023-06-02 21:41:36 -07:00
title_tag: "YAML | Languages & SDKs"
2023-05-15 15:25:28 -07:00
meta_desc: An overview of how to use Pulumi YAML for infrastructure as code on any cloud (AWS, Azure, Google Cloud, Kubernetes, etc.).
2023-01-25 18:41:30 +00:00
title: YAML
2023-05-15 15:25:28 -07:00
h1: Pulumi & YAML
2023-06-08 16:15:52 -07:00
meta_image: /images/docs/meta-images/docs-meta.png
2022-05-03 21:23:32 -07:00
menu:
2023-05-15 15:25:28 -07:00
languages:
identifier: yaml-language
2023-05-23 11:33:15 -07:00
weight: 6
2022-05-03 21:23:32 -07:00
2023-05-15 15:25:28 -07:00
aliases:
- /yaml/
- /docs/intro/languages/yaml/
2022-05-03 21:23:32 -07:00
---
< img src = "/logos/tech/yaml.svg" align = "right" width = "150" style = "padding:8px; margin-top: -64px" >
Pulumi supports writing your infrastructure as code using Pulumi YAML. Pulumi YAML is a
configuration language designed to make describing infrastructure as simple as possible. It supports
managing infrastructure on any cloud, including Azure, AWS, and Google Cloud.
## Prerequisites
2023-05-15 15:25:28 -07:00
All you need to use Pulumi YAML is the [Pulumi CLI ](/docs/install/ ).
2022-05-03 21:23:32 -07:00
## Example
```yaml
name: simple-yaml
runtime: yaml
2023-09-07 11:35:13 -07:00
config:
message:
default: Hello, world!
type: string
2022-05-03 21:23:32 -07:00
resources:
my-bucket:
type: aws:s3:Bucket
properties:
website:
indexDocument: index.html
2023-09-07 11:35:13 -07:00
ownership-controls:
type: aws:s3:BucketOwnershipControls
properties:
bucket: ${my-bucket.id}
rule:
objectOwnership: ObjectWriter
public-access-block:
type: aws:s3:BucketPublicAccessBlock
properties:
bucket: ${my-bucket.id}
blockPublicAcls: false
2022-05-03 21:23:32 -07:00
index.html:
type: aws:s3:BucketObject
properties:
bucket: ${my-bucket}
source:
2023-09-07 11:35:13 -07:00
fn::stringAsset: < h1 > ${message}< / h1 >
2022-05-03 21:23:32 -07:00
acl: public-read
contentType: text/html
2023-09-07 11:35:13 -07:00
options:
dependsOn:
- ${ownership-controls}
- ${public-access-block}
2022-05-03 21:23:32 -07:00
outputs:
bucketEndpoint: http://${my-bucket.websiteEndpoint}
```
{{% notes "info" %}}
The example is a fully valid and self-contained Pulumi project. You only need one file to create resources in Pulumi YAML.
{{% /notes %}}
2022-07-07 15:10:11 +01:00
Further examples are given in the [Pulumi YAML GitHub
repository](https://github.com/pulumi/pulumi-yaml/tree/main/examples). The specification for Pulumi
2023-05-15 15:25:28 -07:00
YAML documents is in the [Pulumi YAML reference ](/docs/languages-sdks/yaml/yaml-language-reference/ ).
2022-07-07 15:10:11 +01:00
2022-05-03 21:23:32 -07:00
## Templates
The fastest way to start a new project is to use a template. The template will initialize a Pulumi
project and set up starter resources for the chosen cloud. The `yaml` template is cloud agnostic.
- `pulumi new aws-yaml` : creates a starter AWS Pulumi YAML project
- `pulumi new azure-yaml` : creates a starter Azure Pulumi YAML project
- `pulumi new gcp-yaml` : creates a starter Google Cloud Pulumi YAML project
2022-05-05 12:40:40 -07:00
- `pulumi new kubernetes-yaml` : creates a starter Kubernetes Pulumi YAML project
2022-05-03 21:23:32 -07:00
2023-10-06 10:36:49 -07:00
By default, `pulumi new` provides a number of templates provided by Pulumi, but it can also use your own custom templates.
To learn more about building and working with custom templates, see [Custom Templates ](/docs/pulumi-cloud/developer-portals/templates ) and the [`pulumi new` ](/docs/cli/commands/pulumi_new/ ) docs.
2022-05-03 21:23:32 -07:00
## Pulumi Programming Model
The Pulumi programming model defines the core concepts you will use when creating infrastructure as
2023-05-15 15:25:28 -07:00
code programs using Pulumi. [Concepts ](/docs/intro/concepts )
2022-05-03 21:23:32 -07:00
describes these concepts with examples available in all supported languages, including Pulumi YAML.
To learn how the Pulumi Programming Model is implemented for Pulumi YAML, refer
2023-05-15 15:25:28 -07:00
to the [Pulumi YAML Reference Guide ](/docs/languages-sdks/yaml/yaml-language-reference/ ).
2022-05-03 21:23:32 -07:00
## Compiler support
Pulumi YAML includes native support for languages that compile to YAML/JSON via
the `compiler` runtime option.
```yaml
name: generated-from-cue
runtime:
name: yaml
options:
compiler: cue export
```
Pulumi will run whatever program and arguments are specified in `compiler` and
interpret the output as a Pulumi YAML program.
2023-05-15 15:25:28 -07:00
## YAML Packages
The [Pulumi Registry ](/registry/ ) houses 100+ YAML packages.