Web Server Using Amazon EC2
Basic C# example of an AWS web server accessible over HTTP.
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set aws-cs-webservercd pulumi-examples/aws-cs-webserverAn example based on the Amazon sample at: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/deploying.applications.html. The example deploys an EC2 instance and opens port 80.
Deploying the App#
To deploy your infrastructure, follow the below steps.
Prerequisites#
Deploying and running the program#
-
Create a new stack:
$ pulumi stack init dev -
Set the AWS region:
$ pulumi config set aws:region us-west-2 -
Run
pulumi upto preview and deploy changes:$ pulumi upPreviewing changes:...Performing changes:...info: 10 changes performed:+ 10 resources createdUpdate duration: 26.470339302s -
View the host name and IP address of the instance via
stack output:$ pulumi stack outputCurrent stack outputs (2):OUTPUT VALUEPublicDns ec2-34-217-176-141.us-west-2.compute.amazonaws.comPublicIp 34.217.176.141 -
Verify that the EC2 instance exists, by either using the AWS Console or running
aws ec2 describe-instances. -
From there, feel free to experiment. Simply making edits and running
pulumi upwill incrementally update your stack. -
Once you’ve finished experimenting, tear down your stack’s resources by destroying and removing it:
Terminal window pulumi destroy --yespulumi stack rm --yes