Code Monkey home page Code Monkey logo

hello-world-terraform-go-demo's Introduction

Deploying a "Hello, World!" Go web server to AWS using Terraform

Image of Gopher Interviwing

Image auto-generated using the dancing gopher web server.

Credit: Valentin Deleplace

🛰️ Technologies

Amazon AWS Terraform Go HTML5

This folder contains an example Terraform configuration that deploys a simple Golang "Hello, World" application across a cluster of web servers (using EC2 and Auto Scaling in an Amazon Web Services (AWS) account.

🔭 Overview

This project will deploy the following AWS resources.

💡 Below are links to the examples and tests included in this repo.

  • Complete Example - A complete example of the "Hello, World!" web app being deployed with all of the resources listed above.
  • Test - Automatically deploy the example above, see if the ELB returns "Hello, World!", and then destroy the deployed resources.

⚙️ Modules

main.tf utilizes my two custom Terraform modules. These modules should be pinned to v1.0.0.

Name Version
smithlabs/terraform-aws-asg-rolling-deploy v1.0.0
smithlabs/terraform-aws-elb v1.0.0

Here is where these modules are used in main.tf.

🐾 Pre-requisites

Please note that this code was written for Terraform 0.13.x.

🔬 Requirements

Name Version
terraform >= 0.13.0
aws >= 2.35

🐇 Quickstart

Please note that this example will deploy real resources into your AWS account. We have made every effort to ensure all the resources qualify for the AWS Free Tier, but we are not responsible for any charges you may incur.

Configure your AWS access keys as environment variables:

export AWS_ACCESS_KEY_ID=(your access key id)
export AWS_SECRET_ACCESS_KEY=(your secret access key)

Deploy the code:

terraform init
terraform apply

When the apply command completes, it will output the DNS name of the load balancer. To test the load balancer:

curl http://<elb_dns_name>/

GIF - Accessing the Go web app via AWS ELB DNS

Clean up when you're done:

terraform destroy

⬆ back to top

📥Inputs

Name Description Type Default Required
environment The environment name to add to the auto scaling group and ELB resources. string test no
name The name to prepend to the auto scaling group and ELB resources. string hello-world no
server_port The port the server will use for HTTP requests. number 8080 no

📤 Outputs

Name Description
elb_dns_name The DNS name for the Elastic Load Balancer

🤝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests and examples as appropriate.

🏆 Show your support

Please ⭐️ this repository if this project helped you!

Resources

  • EmojiTerra - Copy and paste emojis into your README

📝License

MIT

hello-world-terraform-go-demo's People

Contributors

smithlabs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.