Effective DevOps with AWS - Second Edition

Book description

Scale and maintain outstanding performance in your AWS-based infrastructure using DevOps principles

Key Features

  • Implement continuous integration and continuous deployment pipelines on AWS
  • Gain insight from an expert who has worked with Silicon Valley's most high-profile companies
  • Implement DevOps principles to take full advantage of the AWS stack and services

Book Description

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.

What you will learn

  • Implement automatic AWS instance provisioning using CloudFormation
  • Deploy your application on a provisioned infrastructure with Ansible
  • Manage infrastructure using Terraform
  • Build and deploy a CI/CD pipeline with Automated Testing on AWS
  • Understand the container journey for a CI/CD pipeline using AWS ECS
  • Monitor and secure your AWS environment

Who this book is for

Effective DevOps with AWS is for you if you are a developer, DevOps engineer, or you work in a team which wants to build and use AWS for software infrastructure. Basic computer science knowledge is required to get the most out of this book.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Effective DevOps with AWS Second Edition
  3. Packt Upsell
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. The Cloud and DevOps Revolution
    1. Thinking in terms of the cloud, and not infrastructure
      1. Deploying your own hardware versus in the cloud
      2. Cost analysis
      3. Just-in-time infrastructure
        1. The different layers of a cloud
    2. Adopting a DevOps culture
      1. The origin of DevOps
      2. The developers versus operations dilemma
        1. Too much code changing at once
      3. Differences in the production environment
        1. Communication
      4. Key characteristics of a DevOps culture
        1. Source control everything
        2. Automating testing
        3. Automating infrastructure provisioning and configuration
        4. Automating deployment
        5. Measuring everything
    3. Deploying in AWS
      1. How to take advantage of the AWS ecosystem?
      2. How does AWS synergize with a DevOps culture?
    4. Summary
    5. Questions
    6. Further reading
  7. Deploying Your First Web Application
    1. Technical requirements
    2. Creating and configuring your account
      1. Signing up
      2. Enabling MFA on the root account
      3. Creating a new user in IAM
      4. Installing and configuring the command-line interface (CLI)
        1. Installing WSL (Windows only)
        2. Installing the AWS CLI package
        3. Configuring the AWS CLI
    3. Creating our first web server
      1. Amazon Machine Images (AMIs)
      2. Instance types
      3. Security groups
      4. Generating your SSH keys
      5. Launching an EC2 instance
      6. Connecting to the EC2 instance using SSH
      7. Creating a simple Hello World web application
        1. Installing Node.js
        2. Running a Node.js Hello World application
        3. Turning our simple code into a service using upstart
      8. Terminating our EC2 instance
    4. Summary
    5. Questions
    6. Further reading
  8. Treating Your Infrastructure as Code
    1. Technical requirements
    2. Managing your infrastructure with CloudFormation
      1. Getting started with CloudFormation
      2. AWS CloudFormation Designer
      3. CloudFormer
      4. Recreating our Hello World example with CloudFormation
        1. Using Troposphere to create a Python script for our template
      5. Creating the stack in the CloudFormation console
      6. Adding our template to a source control system
      7. Updating our CloudFormation stack
        1. Updating our Python script
        2. Updating our stack
      8. Change sets
      9. Deleting our CloudFormation stack
    3. Adding a configuration management system
      1. Getting started with Ansible
      2. Installing Ansible on your computer
      3. Creating our Ansible playground
      4. Creating our Ansible repository
      5. Executing modules
      6. Running arbitrary commands
      7. Ansible playbooks
        1. Creating a playbook
        2. Creating roles to deploy and start our web application
        3. Creating the playbook file
        4. Executing a playbook
        5. Canary-testing changes
        6. Running Ansible in pull mode
      8. Installing Git and Ansible on our EC2 instance
        1. Configuring Ansible to run on localhost
        2. Adding a cron job to our EC2 instance
        3. Integrating Ansible with CloudFormation
      9. Monitoring
    4. Summary
    5. Questions
    6. Further reading
  9. Infrastructure as Code with Terraform
    1. Technical requirements
    2. What is Terraform?
      1. Getting started with Terraform
      2. Terraform and AWS for automated provisioning
        1. Deployment using AWS Management Console
        2. Deployment using AWS CLI
    3. Creating our Terraform repository
      1. First Terraform template for AWS instance provisioning
      2. A second Terraform template for deploying a Hello World application
    4. Integrating AWS, Terraform, and Ansible
      1. Terraform with Ansible using a push-based approach
        1. Terraform with Ansible using the pull-based approach
    5. Summary
    6. Questions
    7. Further reading
  10. Adding Continuous Integration and Continuous Deployment
    1. Technical requirements
    2. Building a CI pipeline
      1. Creating a Jenkins server using Ansible and CloudFormation
        1. Creating the Ansible playbook for Jenkins
        2. Creating the CloudFormation template
        3. Launching the stack and configuring Jenkins
      2. Preparing our CI environment
        1. Creating a new GitHub organization and repository
        2. Creating a GitHub personal access token
        3. Adding the access token to the credentials in Jenkins
        4. Creating the Jenkins job to automatically run the builds
      3. Implementing the helloworld application using our CI environment
        1. Initializing the project
        2. Creating a functional test using Mocha
        3. Developing the remainder of the application
        4. Creating the CI pipeline in Jenkins
      4. Productionizing the CI pipeline
    3. Building a continuous deployment pipeline
      1. Creating new web servers for continuous deployment
        1. Importing a custom library to Ansible for AWS CodeDeploy
        2. Creating a CodeDeploy Ansible role
        3. Creating the web server CloudFormation template
        4. Launching our web server
      2. Integrating our helloworld application with CodeDeploy
        1. Creating the IAM service role for CodeDeploy
        2. Creating the CodeDeploy application
        3. Adding the CodeDeploy configuration and scripts to our repository
      3. Building our deployment pipeline with AWS CodePipeline
        1. Creating a continuous deployment pipeline for staging
        2. Integrating Jenkins to our CodePipeline pipeline
          1. Updating the IAM profile through CloudFormation
          2. Installing and using the CodePipeline Jenkins plugin
          3. Adding a test stage to our pipeline
        3. Building a continuous delivery pipeline for production
          1. Creating the new CloudFormation stack for production
          2. Creating a CodeDeploy group to deploy to production
          3. Adding a continuous delivery step to our pipeline
        4. Strategies to practice continuous deployments in production
          1. Fail fast
          2. Canary deployment
          3. Feature flags
    4. Summary
    5. Questions
    6. Further reading
  11. Scaling Your Infrastructure
    1. Technical requirements
    2. A monolithic application
      1. What is a monolithic application?
        1. Associating a DNS name
      2. Scaling a monolithic application
      3. Advantages of a monolith
    3. The database
      1. Moving the database to the RDS
      2. Choose the RDS type
      3. Backup
      4. Multi-AZ
      5. ElastiCache
    4. Elastic Load Balancer (ELB)
      1. Choosing the right ELB
      2. Deploying the balancer
        1. Step 1 – open the access for the port 8080 from the whole VPC CIDR 
        2. Step 2 – Creating the ALB and associate to the EC2 machine
        3. Step 3 – creating an alias for the ELB
        4. Step 4 – removing the Apache software from the machine 
      3. Configuring the SSL certificate
      4. ALB and integration with Auth0
      5. Pre-warming a load balancer
      6. Access/error logs
      7. The next step
    5. Moving the state outside the EC2 machine
      1. Pushing the logs out
    6. Configure Auto Scaling
      1. Moving our example inside Auto Scaling
        1. Preparing the image
        2. Using the wizard launch configuration part
        3. Auto Scaling group part
        4. Scaling policies
        5. Modifying the Auto Scaling group
        6. Removing the manually created instance from the balancer 
    7. Using microservices and serverless
    8. Summary
    9. Questions
    10. Further reading
  12. Running Containers in AWS
    1. Technical requirements
    2. Dockerizing our Hello World application
      1. Getting started with Docker
      2. Docker fundamentals
      3. Docker in action
      4. Creating our Dockerfile
    3. Using the EC2 container service
      1. Creating an ECR repository to manage our Docker image
      2. Creating an ECS cluster
      3. Creating an ALB
      4. Creating our ECS hello world service
    4. Creating a CI/CD pipeline to deploy to ECS
      1. Creating our production ECS cluster
      2. Automating the creation of containers with CodeBuild
      3. Creating our deployment pipeline with CodePipeline
      4. Adding the CloudFormation template to our code base
      5. Creating a CloudFormation template for CodePipeline
      6. Starting and configuring our CloudFormation stack
    5. Summary
    6. Questions
    7. Further reading
  13. Hardening the Security of Your AWS Environment
    1. Technical requirements
    2. IAM security
      1. Root account
        1. Root account password
        2. Delete your root access keys
      2. Setting up a password policy for IAM users
        1. Creating an administrator group and a personal IAM user 
        2. AmazonEC2FullAccess policy
        3. Final security status
    3. CloudTrail
      1. VPC Flow Logs
      2. Creating the flow log for one subnet
      3. Verifying the flow logs 
      4. VPC Flow Log consideration
    4. VPC subnets 
      1. Routing and subnet types
        1. Accessing private subnets
        2. What to place in which subnet?
        3. Identifying subnets from the web console
      2. Endpoint routing
    5. AWS WAF
      1. Web application playground
        1. Allow a sub-URL to be accessible only from an IP 
        2. Testing with the command line
        3. Identifying the WAF from the web console
      2. Blocking DoS/DDoS attacks
        1. Creating AWS WAF with Terraform
        2. DDoS attach consideration
      3. WAF for SQL Injection (SQLi)
    6. Summary 
    7. Questions
    8. Further reading
  14. Assessment
    1. Chapter 1: The Cloud and DevOps Revolution
    2. Chapter 2: Deploying Your First Web Application
    3. Chapter 3: Treating Your Infrastructure as Code
    4. Chapter 4:  Infrastructure as Code with Terraform
    5. Chapter 5: Adding Continuous Integration and Continuous Deployment
    6. Chapter 6: Scaling Your Infrastructure
    7. Chapter 7: Running Containers in AWS
    8. Chapter 8: Hardening the Security of Your AWS Environment
  15. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Effective DevOps with AWS - Second Edition
  • Author(s): Yogesh Raheja, Giuseppe Borgese, Nathaniel Felsen
  • Release date: September 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781789539974