Infrastructure as Code for Beginners: Deploy and manage your cloud-based services with Terraform and Ansible

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Master Infrastructure as Code (IaC) and streamline your DevOps workflows using Terraform and Ansible Key Features • Employ effective strategies and approach IaC projects efficiently by diving deep into its fundamentals • Understand the working of Terraform and Ansible and integrate them into your CI/CD workflows • Work with real-world examples of IaC across multiple cloud providers (Azure & AWS) Book Description The Infrastructure as Code (IaC) approach ensures consistent and repeatable deployment of cloud-based IaaS/PaaS services, saving you time while delivering impeccable results. Infrastructure as Code for Beginners is a practical implementation guide that helps you gain a clear understanding of the foundations of Infrastructure as Code and make informed decisions when implementing it. With this book, you’ll uncover essential IaC concepts, including planning, selecting, and implementing the right tools for your project. With step-by-step explanations and real-world examples, you’ll gain a solid understanding of the benefits of IaC and the scope of application in your projects. You’ll learn about the pros, cons, and best practices of different IaC tools such as Terraform and Ansible, and their use at different stages of the deployment process along with GitHub Actions. Using these tools, you’ll be able to design, deploy, and secure your infrastructure on two major cloud platforms, Microsoft Azure and Amazon Web Services. In addition, you’ll explore other IaC tools such as Pulumi, AWS CloudFormation, and Azure Bicep. By the end of this book, you’ll be well equipped to approach your IaC projects confidently. What you will learn • Determine the right time to implement Infrastructure as Code for your workload • Select the appropriate approach for Infrastructure-as-Code deployment • Get hands-on experience with Ansible and Terraform and understand their use cases • Plan and deploy a workload to Azure and AWS clouds using Infrastructure as Code • Leverage CI/CD in the cloud to deploy your infrastructure using your code • Discover troubleshooting tips and tricks to avoid pitfalls during deployment Who this book is for This book is for cloud engineers, software developers, or system administrators responsible for deploying resources to host applications. Ideal for both beginners and experienced professionals seeking to deepen their knowledge. Experience in manually deploying resources for applications in public clouds such as AWS or Microsoft Azure is a must. A basic understanding of programming or scripting languages, such as Python, Bash, PowerShell, etc. as well as familiarity with version control systems like Git, is a prerequisite.

Author(s): Russ McKendrick
Edition: 1
Publisher: Packt Publishing
Year: 2023

Language: English
Commentary: Publisher's PDF
Pages: 222
City: Birmingham, UK
Tags: DevOps; Amazon Web Services; Microsoft Azure; Deployment; Best Practices; Troubleshooting; Continuous Delivery; Continuous Integration; Ansible; Terraform; Infrastructure as Code; Pulumi; GitHub Actions; Azure Bicep

Cover
Title Page
Copyright and Credits
Contributors
Table of Contents
Preface
Part 1: The Foundations – An Introduction to Infrastructure as Code
Chapter 1: Choosing the Right Approach – Declarative or Imperative
The challenges of managing infrastructure manually
My own journey
Today’s challenges
Conclusion
What is meant by declarative and imperative?
Basic Infrastructure-as-Code project
Declarative approach
Imperative approach
Pets versus cattle
Pets
Cattle
Conclusion
What does all this mean for our Infrastructure-as-Code deployments?
Summary
Further reading
Chapter 2: Ansible and Terraform beyond the Documentation
What is important when choosing a tool?
Deployment types
Infrastructure and configuration
External interactions and secrets
Ease of use
Summary
Introducing Terraform
An HCL example – creating a resource group
Adding more resources
Introducing Ansible
An Ansible example
Introducing Visual Studio Code
Summary
Further reading
Chapter 3: Planning the Deployment
Planning the deployment of our workload
How to approach the deployment of our infrastructure
Deployment considerations
Performing deployment tasks
Introducing cloud-init
Exploring the high-level architecture
Summary
Further reading
Part 2: Getting Hands-On with the Deployment
Chapter 4: Deploying to Microsoft Azure
Technical requirement
Introducing and preparing our cloud environment
Preparing our cloud environment for deployment
Producing the low-level design
Terraform – writing the code and deploying our infrastructure
Setting up the Terraform environment
Creating a resource group
Networking
Ansible – reviewing the code and deploying our infrastructure
Ansible Playbook roles overview
Running the Ansible Playbook
Summary
Further reading
Chapter 5: Deploying to Amazon Web Services
Technical requirements
Introducing Amazon Web Services
Preparing our cloud environment for deployment
Producing the low-level design
Ansible – writing the code and deploying our infrastructure
Ansible playbook roles
Running the Ansible playbook
Terraform – reviewing the code and deploying our infrastructure
Walk-through of Terraform files
Deploying the environment
Summary
Further reading
Chapter 6: Building upon the Foundations
Understanding cloud-agnostic tools
Understand the differences between our Microsoft Azure and Amazon Web Services deployments
General
Network
Storage
Virtual machine (admin)
Virtual machines with scaling (web)
Seeing it in action
Understanding the differences between our Terraform and Ansible deployments
Introducing more variables
Making the code more reusable
Pop quiz
Summary
Further reading
Answers
Part 3: CI/CD and Best Practices
Chapter 7: Leveraging CI/CD in the Cloud
Technical requirements
Introducing GitHub Actions
Running Terraform using GitHub Actions
Terraform state files
GitHub Actions
Running Ansible using GitHub Actions
Security best practices
Pop quiz
Summary
Further reading
Answers
Chapter 8: Common Troubleshooting Tips and Best Practices
Technical requirements
Infrastructure as Code – best practices and troubleshooting
General IaC best practices
General IaC troubleshooting tips
Terraform – best practices and troubleshooting
Terraform – best practices
Terraform – troubleshooting
Ansible – best practices and troubleshooting
Ansible – best practices
Ansible – troubleshooting
Summary
Chapter 9: Exploring Alternative Infrastructure-as-Code Tools
Technical requirements
Getting hands-on with Pulumi
Using Pulumi and YAML
Using Pulumi and Python
Getting hands-on knowledge of Azure Bicep
Working through the Bicep file
Deploying the Bicep file
Getting hands-on with AWS CloudFormation
AWS CloudFormation template
Using the AWS CLI to deploy
Using the AWS Management Console to deploy
Summary
Further reading
Index
About Packt
Other Books You May Enjoy