An example based on the basic Amazon EC2 Instance sample at: http:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/deploying.applications.html. The example deploys an EC2 instance and opens port 80. To get the correct Amazon Linux AMI for the instance size and region, a mapping is defined in ami.py.
-
Login to the Pulumi CLI via
pulumi login
. -
Initialize a Pulumi repository with pulumi init, using your GitHub username. (Note: this step will be removed in the future.)
$ pulumi init --owner githubUsername
-
Create a new stack:
$ pulumi stack init webserver-testing Created stack 'webserver-testing'.
-
Run
pulumi preview
:$ pulumi preview Previewing stack 'python-test' in the Pulumi Cloud ☁️ Previewing changes: pulumi:Stack("webserver-py-python-test"): Completed aws:SecurityGroup("web-secgrp"): + Would create aws:Instance("web-server-www"): + Would create info: 3 changes previewed: + 3 resources to create
-
Run
pulumi update
:$ pulumi update Updating stack 'python-test' in the Pulumi Cloud ☁️ Performing changes: pulumi:Stack("webserver-py-python-test"): Completed aws:SecurityGroup("web-secgrp"): + Created aws:Instance("web-server-www"): + Created info: 3 changes performed: + 3 resources created Update duration: 26.445180782s
-
Verify that the EC2 instance exists, by either using the AWS Console or running
aws ec2 describe-instances
. -
Clean up resources by running
pulumi destroy
.