Skip to main content

Pulumi import/export


pulumi refresh

ν˜„μž¬ μŠ€νƒμ˜ λ¦¬μ†ŒμŠ€ μƒνƒœλ₯Ό μ‹€μ œ ν΄λΌμš°λ“œμ™€ λΉ„κ΅ν•˜μ—¬ μ—…λ°μ΄νŠΈ ν•©λ‹ˆλ‹€.

pulumi refresh [flags]

pulumi import

pulumi import [type] [name] [id] [flags]

직접 μƒμ„±ν•˜κ±°λ‚˜ λ‹€λ₯Έ ν”„λ‘œκ·Έλž¨μ— μ˜ν•΄ μƒμ„±λœ λ¦¬μ†ŒμŠ€λ₯Ό ν˜„μž¬ μŠ€νƒμ— μΆ”κ°€ν•©λ‹ˆλ‹€. μΆ”κ°€λœ λ¦¬μ†ŒμŠ€λ₯Ό μ½”λ“œλ‘œ μΆ”κ°€ν•  수 μžˆλ„λ‘ μ˜ˆμ‹œ μ½”λ“œλ₯Ό 좜λ ₯ν•΄μ€λ‹ˆλ‹€. μ™ΈλΆ€μ—μ„œ κ°€μ Έμ˜€ λ¦¬μ†ŒμŠ€λŠ” 기본적으둜 ν”„λ‘œν…νŒ… λ˜μ–΄ μžˆμ–΄μ„œ ν”„λ‘œν…νŠΈλ₯Ό 풀어주지 μ•ŠλŠ” ν•œ 변경이 μ•ˆλ©λ‹ˆλ‹€.

$ pulumi import aws:ec2/subnet:Subnet public_subnet subnet-xxxxxxxxx

Previewing import (dev):
Type Name Plan
pulumi:pulumi:Stack master-dev
= └─ aws:ec2:Subnet public_subnet import

Resources:
= 1 to import
xx unchanged

Do you want to perform this import? yes
Importing (dev):
Type Name Status
pulumi:pulumi:Stack master-dev
= └─ aws:ec2:Subnet public_subnet imported

Outputs:
...

Resources:
= 1 imported
xx unchanged

Duration: 5s

Please copy the following code into your Pulumi application. Not doing so
will cause Pulumi to report that an update will happen on the next update command.

Please note that the imported resources are marked as protected. To destroy them
you will need to remove the `protect` option and run `pulumi update` *before*
the destroy will take effect.

import pulumi
import pulumi_aws as aws

public_subnet = aws.ec2.Subnet("public_subnet",
assign_ipv6_address_on_creation=False,
cidr_block="1.2.3.4/24",
map_public_ip_on_launch=False,
tags={
"Name": "test",
},
vpc_id="vpc-xxxxx",
opts=pulumi.ResourceOptions(protect=True))

pulumi stack export

pulumi stack export [flags]

flags

  • --file <path>: 파일둜 μ €μž₯

pulumi stack import

pulumi stack import [flags]

flags

  • --file <path>: νŒŒμΌμ„ μ½μ–΄μ˜΄
info

pulumi stack export --file stack.json으둜 μŠ€νƒμ„ μΆ”μΆœν•΄μ„œ 이름, id 등을 λ³€κ²½ν•˜κ±°λ‚˜, λ¦¬μ†ŒμŠ€λ₯Ό μΆ”κ°€ν•˜κ±°λ‚˜ μ‚­μ œν•œ ν›„, pulumi stack import --file stack.json으둜 μŠ€νƒμ„ λ‹€μ‹œ μ„€μ •ν•΄ 쀄 수 μžˆμŠ΅λ‹ˆλ‹€.