scottslowe-learning-tools/debian/debian-pulumi-aws
Scott S. Lowe bee1114862
chore: add/update go.sum files
Add or update go.sum files for Go-based projects/examples

Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org>
2024-09-10 16:06:39 -06:00
..
go.mod SSH key fixes 2023-11-19 17:48:46 -07:00
go.sum chore: add/update go.sum files 2024-09-10 16:06:39 -06:00
main.go SSH key fixes 2023-11-19 17:48:46 -07:00
Pulumi.yaml Add empty Go program 2023-11-08 11:19:29 -07:00
README.md Finish Pulumi program 2023-11-08 11:19:29 -07:00

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 the pulumi CLI, 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.

  1. 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.

  2. Run pulumi stack init to create a new stack.

  3. 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.

  4. 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.

  5. (Optional) Run pulumi config set to 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".
  6. Run pulumi up to 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.