Skip to main content

Pulumi basics


Installation

AWS

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
  • AWS Access Key ID and Access Key: IAM -> μ‚¬μš©μž -> <user> -> λ³΄μ•ˆ 자격 증λͺ… -> μ•‘μ„ΈμŠ€ ν‚€ λ§Œλ“€κΈ°
aws configure

Pulumi

curl -fsSL https://get.pulumi.com | sh
pulumi login [<url>]
  • url
    • s3://<pulumi-stack-bucket>
    • file://<pulumi-stack-path>

Tutorial

mkdir test && cd test
pulumi new aws-python
test
β”œβ”€β”€ __main__.py
β”œβ”€β”€ Pulumi.dev.yaml
β”œβ”€β”€ Pulumi.yaml
β”œβ”€β”€ requirements.txt
└── venv/
Pulumi.yaml
name: test
runtime:
name: python
options:
virtualenv: venv
description: A minimal AWS Python Pulumi program
Pulumi.dev.yaml
encryptionsalt: ***
config:
aws:region: us-west-2
import pulumi
import pulumi_aws as aws

aws_instance = aws.ec2.Instance(
"app_server",
ami="ami-090717c950a5c34d3",
instance_type="t3.micro",
tags={
"Name": "HelloWorld",
},
)

pulumi.export("instance_id", aws_instance.id)
pulumi.export("instance_public_ip", aws_instance.public_ip)
pulumi refresh --yes --skip-preview
pulumi up
pulumi destroy --skip-preview
pulumi stack rm dev

Reference