Book Image

Effective DevOps with AWS - Second Edition

By : Yogesh Raheja, Giuseppe Borgese, Nathaniel Felsen
Book Image

Effective DevOps with AWS - Second Edition

By: Yogesh Raheja, Giuseppe Borgese, Nathaniel Felsen

Overview of this book

The DevOps movement has transformed the way modern tech companies work. Amazon Web Services (AWS), which has been at the forefront of the cloud computing revolution, has also been a key contributor to the DevOps movement, creating a huge range of managed services that help you implement DevOps principles. Effective DevOps with AWS, Second Edition will help you to understand how the most successful tech start-ups launch and scale their services on AWS, and will teach you how you can do the same. This book explains how to treat infrastructure as code, meaning you can bring resources online and offline as easily as you control your software. You will also build a continuous integration and continuous deployment pipeline to keep your app up to date. Once you have gotten to grips will all this, we'll move on to how to scale your applications to offer maximum performance to users even when traffic spikes, by using the latest technologies, such as containers. In addition to this, you'll get insights into monitoring and alerting, so you can make sure your users have the best experience when using your service. In the concluding chapters, we'll cover inbuilt AWS tools such as CodeDeploy and CloudFormation, which are used by many AWS administrators to perform DevOps. By the end of this book, you'll have learned how to ensure the security of your platform and data, using the latest and most prominent AWS tools.
Table of Contents (15 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Chapter 4:  Infrastructure as Code with Terraform


  1. Terraform is a high level infrastructure tool that is primarily used for building, changing, and versioning infrastructure safely and efficiently. Terraform is not a configuration management tool as it focuses on the infrastructure layer and allows tools such as Puppet, Chef, Ansible, and Salt to perform application deployment and orchestration.
  2. HashiCorp does not provide native packages for operating systems. Terraform is distributed as a single binary, packaged inside a ZIP archive, which can be downloaded from https://www.terraform.io/downloads.html. Once downloaded, extract the .zip file and place it under the /usr/bin Linux binary path. Once this is done, run terraform -v to confirm the installed Terraform version.
  3. In order to provision AWS instances using Terraform, you need to initialize the AWS provider by creating a  provider block inside the .tf file. You then have to run terraform init. Upon successful initialization, you need to proceed by developing a Terraform template with resources. In this case, you need to use the aws_instance resource type with the appropriate attribute. Once this is done, validated, and planned, apply your Terraform template to create your first AWS instance.
  4. In order to configure Terraform with Ansible, you need to use a provider, to initialize the platform; resources, to create the platform-related services; and finally provisioner, to establish a connection with the created service to install Ansible and to run ansible-pull to run Ansible code on the system. You may refer to the following link for a sample Terraform template: https://raw.githubusercontent.com/yogeshraheja/EffectiveDevOpsTerraform/master/fourthproject/helloworldansiblepull.tf.