Book Image

Implementing Cloud Design Patterns for AWS - Second Edition

By : Sean Keery, Clive Harber, Marcus Young
Book Image

Implementing Cloud Design Patterns for AWS - Second Edition

By: Sean Keery, Clive Harber, Marcus Young

Overview of this book

Whether you're just getting your feet wet in cloud infrastructure or already creating complex systems, this book will guide you through using the patterns to fit your system needs. Starting with patterns that cover basic processes such as source control and infrastructure-as-code, the book goes on to introduce cloud security practices. You'll then cover patterns of availability and scalability and get acquainted with the ephemeral nature of cloud environments. You'll also explore advanced DevOps patterns in operations and maintenance, before focusing on virtualization patterns such as containerization and serverless computing. In the final leg of your journey, this book will delve into data persistence and visualization patterns. You'll get to grips with architectures for processing static and dynamic data, as well as practices for managing streaming data. By the end of this book, you will be able to design applications that are tolerant of underlying hardware failures, resilient against an unexpected influx of data, and easy to manage and replicate.
Table of Contents (20 chapters)
Title Page
Dedication
About Packt
Contributors
Preface
Free Chapter
1
Introduction to Amazon Web Services
Index

CodeBuild


We will initially use CodeBuild projects to help us automate our Terraform development life cycle. Variables are a construct we have not yet used in our configuration. In your Cloud9 IDE, copy your main.tf file from the previous chapter to a new folder called Chapter5. Now, let's create a variable file called tfvars.tf and add the following information:

variable "vpc_id" {
  default = "vpc-1802fb62"
}

variable "aws_public_subnet_id" {
  default = "subnet-476f170d"
}

Note

Do not put sensitive information in your variables file.

The two variables we created will be used in our next file. In the default VPC, all networks are public. To increase security, we will create a private network for build projects. In a new file called private.tf, add the following code:

resource "aws_subnet" "cloudpatterns_private" {
  vpc_id = "${var.vpc_id}"
  cidr_block = "172.31.96.0/20"
  map_public_ip_on_launch = false
}

resource "aws_eip" "natgw_eip" {
  vpc = true
}

resource "aws_nat_gateway" "cloudpatterns_nat_gw...