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

Logging


Logging provides us with insight into the availability and integrity of our clouds.

CloudTrail

CloudTrail captures and records account activity:

resource "aws_cloudtrail" "example" {
  name = "tf-trail-foobar"
  s3_bucket_name = "${aws_s3_bucket.mybookbucket.id}"
  s3_key_prefix = "prefix"
  include_global_service_events = false
  kms_key_id : "${aws_kms_key.book_key.id}"

  event_selector {
    read_write_type = "All"
    include_management_events = true

    data_resource {
      type = "AWS::S3::Object"
      values = ["arn:aws:s3:::"]
    }
  }
}

CloudWatch events

CloudWatch is primarily used for monitoring your cloud. It should be used to capture metrics and has nice dashboarding features available in the console. Streaming the events to logs is a good idea. Events can also be based on flow logs and CloudTrail logs:

resource "aws_cloudwatch_log_group" "book_log_group" {
  name = "book_log_group"
}

resource "aws_cloudwatch_log_stream" "foo" {
  name = "SampleLogStream1234"
  log_group_name...