Code Monkey home page Code Monkey logo

ec2-userdata-terraform's Introduction

Image

Motivation

One of the first components I created on AWS cloud was an EC2 instance by watching hands-on tutorials. Little did I know about the infrastructure bits that went behind that. In this repository, I have the terraform code to create two AWS EC2 instances using infrastructure as code approach.
I have supporting documentation on my note at: create-aws-ec2-using-terraform

Prerequisites

I installed terraform before I worked on this repository. Installation information is available in the install guide.
I used the access_key and the secret_key of an IAM user that had permission to create all the resources managed via this terraform code.
I created a terraform.tfvars file to store them.

Usage

Ensure that the IAM user whose credentials are being used in this configuration has permission to create and manage all the resources that are included in this repository.
Review the code, especially the ec2.tf file and update the ingress cidr_blocks to allow access from your local network.
To find your IP address, open command prompt and key in: curl ifconfig.me
The value is your local machine's IP address. If you want to restrict access to only your machine, update teh ingress cidr_blocks with that value and append a /32 to it. Else, you could also go up the range and enable access from a wider set of machines.
Next run terraform init
Then run terraform plan
And finally run terraform apply

Interesting use-cases

If you want to have fun, try the following:
Update the security group and see how it impacts your web access: remove the egress block.
Update the route table and see how it impacts your web access: remove the 0.0.0.0/0 route.

ec2-userdata-terraform's People

Contributors

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