Giter Club home page Giter Club logo

packer-ansible-terraform-demo's Introduction

packer-ansible-terraform-demo

This repo is to do a demo together with packer, ansible and terraform with AWS.

Overview

This project creates a AWS EC2 Instance that runs a local version of the website https://growlerfriday.com - which is pulled down from its GitHub repo and run using nginx.

Once created if you put IP address of ec2 into the browser, it should show the website resembleshttps://growlerfriday.com

Usage

Prior to running, make sure you have

  1. awscli installed and configured (both packer and terraform uses this configuration)
  2. packer and terraform installed.

configure awscli if it's not already configured. configure awscli

git clone https://github.com/aleti-pavan/packer-ansible-terraform-demo.git
cd packer-ansible-terraform-demo

cd packer

packer build template.json

cd ../terraform

terraform init; terraform plan; terraform apply -auto-approve;


Test

terraform execution returns 3 outputs like below, in your case IP address will be different to the below

Login-with-Key = ssh -i terraform-key [email protected]
curl = curl http://3.84.111.178
publicIp = 3.84.111.178

you can use curl output to test on the command line or locate the ip into browser to see the website resembles growlerfriday.com

Destroy EC2 and Packer AMI

You will have to destroy created infrastructure in order to avoid any changes from AWS. Following steps would destroy the EC2 instance and also the AMI created by packer.

cd packer-ansible-terraform-demo/terraform

terraform destroy -auto-approve

aws ec2 deregister-image --image-id <image-id> (which is given by packer)

aws ec2 delete-snapshot --snapshot-id <snapshot-id> (take from aws console)

Login to AWS Console and verify the EC2 Dashboard on the right region to make sure all of the created infrastructure (EC2 & AMI) has been deleted.

This project is created with reference to https://github.com/alkrauss48/ansible-packer-terraform-demo , Many Thanks

packer-ansible-terraform-demo's People

Contributors

aleti-pavan avatar

Watchers

James Cloos 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.