Add or update go.sum files for Go-based projects/examples Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org> |
||
|---|---|---|
| .. | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| Pulumi.yaml | ||
| README.md | ||
Debian on AWS Using Pulumi
These files were created to allow users to quickly and easily deploy a Debian EC2 instance using Pulumi. This Pulumi program was written in Go.
While not complex, the Pulumi program here does illustrate a few things that might be useful for newer users:
- Use of the
value, ok := map[key]idiom for checking configuration values passed in from the user - Supporting both X86_64/AMD64- as well as ARM64-based configurations
- Dynamically looking up an AMI
- Modifying the default values for an AWSX VPC to create only public subnets
Contents
-
go.mod: This file contains dependencies used by this Go program. -
go.sum: This file contains checksums for each of the direct and indirect dependencies. The checksum is used to validate that none of them has been modified. -
main.go: This Go file is the Pulumi program executed by thepulumiCLI, and contains the resource definitions to create a VPC with only public subnets, a security group to allow SSH access, and a Debian-based EC2 instance in one of the public subnets. -
Pulumi.yaml: This is the Pulumi project file. -
README.md: This file you're currently reading.
Instructions
These instructions assume you've already installed and configured Pulumi and all necessary dependencies (Go, for this example). Please refer to the Pulumi documentation for more details on installation or configuration.
-
Copy the contents of this directory down to a directory on your system, or clone the entire repository and then change into the directory where this section of the cloned repository resides.
-
Run
pulumi stack initto create a new stack. -
Run
pulumi config set aws:region <region-name>to set the AWS region where the Pulumi program should create resources. This is a required configuration value; CLI operations will fail if you don't set this value. -
Run
pulumi config set keypairname <name-of-aws-keypair>to set the name of the AWS keypair that should be used. This is a required configuration value. -
(Optional) Run
pulumi config setto set configuration values that affect the behavior of the Pulumi program. The optional configuration values are:architecture: Set this to "amd64" or "arm64". The values "x86_64" and "x64" are also supported and will have the same effect as "amd64". The default value is "arm64".networkcidr: Set this to control the CIDR that will be used when the VPC is created. The default value is "10.0.0.0/16".versionname: Set this to "buster", "bullseye", or "bookworm" to control the version of Debian used in the EC2 instance. These version names correspond to version numbers 10, 11, and 12, respectively. The default value is "bookworm".
-
Run
pulumi upto instantiate the resources.
Enjoy! When you're finished, run pulumi destroy to tear down all the provisioned resources.
License
This content is licensed under the MIT License.