Giter Club home page Giter Club logo

aws-terraform-ansible-docker's Introduction

Basic Terraform Help

Prerequisite:

Make sure the following applications are installed and are set in the enviromental path:

  • AWS CLI >= 1.10
  • Terraform >= 0.7.5
  • Ansible >= 2.1.2.0

Export your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as environment variables, and run aws configure to complete setup:

export AWS_ACCESS_KEY_ID=<access-key>
export AWS_SECRET_ACCESS_KEY=<secret-key>

Also, update public_key variable with your public ssh key, the file is located at terraform-aws/variables.tf

Assumptions

This will run in Amazon AWS region eu-west-1, and you will only need AZA and AZB ;)

AWS resources

This application will create the following resources:

  • VPC
  • Routing
  • Subnets
  • Internet Gateway
  • Security Groups
  • Elatic Loadbalance
  • Launch Configuration
  • Autoscaling Groups
  • EC2 Key
  • EC2 Instance(s)

Note: Some of these resource will incur a charge

Files and Directories:

├── ansible
│   ├── hosts.template
│   ├── playbook.retry
│   └── playbook.yml
├── cloud-automation.sh
├── docker
│   └── docker-compose.yml
├── ips_to_file.py
├── LICENSE.md
├── nginx
│   ├── nginx.conf
│   └── proxy.conf
├── README.md
└── terraform-aws
    ├── modules
    │   ├── app_sg
    │   │   ├── main.tf
    │   │   └── variables.tf
    │   ├── asg
    │   │   ├── main.tf
    │   │   └── variables.tf
    │   ├── ec2key
    │   │   ├── main.tf
    │   │   └── variables.tf
    │   ├── elb
    │   │   ├── main.tf
    │   │   └── variables.tf
    │   ├── elb_sg
    │   │   ├── main.tf
    │   │   └── variables.tf
    │   ├── ssh_sg
    │   │   ├── main.tf
    │   │   └── variables.tf
    │   └── vpc_subnets
    │       ├── main.tf
    │       └── variables.tf
    ├── outputs.tf
    ├── site.tf
    ├── userdata.sh
    └── variables.tf

Getting started

To run the application, simply execute the following command:

./cloud-automation.sh web dev 1 t2.nano

Tools Used:

Terraform: To compile, test, run and destroy,

terraform validate
terraform get
terraform plan
terraform graph
terraform apply
terraform show
terraform destroy

Terraform will create all the resources in AWS, you can then use ansible-playbook to deploy applications and docker compose.

Ansible playbook: To run:

ansible-playbook -i hosts playbook.yml

Note: Terraform stores the state of the managed infrastructure from the last time Terraform was run. Terraform uses the state to create plans and make changes to the infrastructure.

aws-terraform-ansible-docker's People

Contributors

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