AWS get ami function in python
-
Initialize a new stack called:
dev
via pulumi stack init.pulumi stack init dev
-
Create a Python virtualenv, activate it, and install dependencies:
python3 -m venv venv source venv/bin/activate pip3 install -r requirements.txt
-
View the current config settings. This will be empty.
pulumi config
KEY VALUE
-
Populate the config. Here are aws endpoints
pulumi config set aws:region us-east-2 # any valid aws region
-
Run
pulumi up
pulumi up
Results
Updating (dev) View Live: https://app.pulumi.com/shaht/aws-classic-py-get-ami/dev/updates/1 Type Name Status + pulumi:pulumi:Stack aws-classic-py-get-ami-dev created Outputs: my_ami: "amzn2-ami-hvm-2.0.20190618-x86_64-gp2" Resources: + 1 created Duration: 4s
-
View the outputs
pulumi stack output
Results
Current stack outputs (1): OUTPUT VALUE my_ami amzn2-ami-hvm-2.0.20190618-x86_64-gp2
-
Clean up
pulumi destroy -y
-
Remove. This will remove the Pulumi.dev.yaml file also
pulumi stack rm dev -y