- Implementing Cloud Design Patterns for AWS(Second Edition)
- Sean Keery Clive Harber Marcus Young
- 332字
- 2021-06-24 15:11:58
Local Traffic Management
Our regional AWS load balancers can provide Local Traffic Management (LTM) services. By adding a layer of abstraction between DNS and our instances, we can take advantage of a number of patterns for maintaining our backing services with little or no downtime.
Chapter 6, Ephemeral Environments - Sandboxes for Experiments, will go into detail about those architectures, but for now, we will add our latest instance to the load balancer, then update DNS (our GTM) to point to our load balancer (our LTM) in addition to the existing instances—see the following changes made to the instanceAZ1c.tf file:
# Create a new load balancer
resource "aws_elb" "cloudelb" {
name = "cloudpatterns-elb"
availability_zones = ["us-east-1c"]
listener {
instance_port = 80
instance_protocol = "http"
lb_port = 80
lb_protocol = "http"
}
health_check {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 3
target = "HTTP:80/"
interval = 30
}
instances = ["${aws_instance.cheap_worker1c.id}"]
cross_zone_load_balancing = true
idle_timeout = 400
connection_draining = true
connection_draining_timeout = 400
}
Remove the aws_route53_record.www resource configuration from the main.tf file. Then, we'll destroy the A record used in the environment by performing the following instruction in the terraform destroy target=aws_route53_record.www bash panel. Now we will need to add a different type of DNS record; we'll create a new file called ltm.tf:
# Global Traffic Management using DNS
resource "aws_route53_record" "wwwltm" {
zone_id = "${aws_route53_zone.book.zone_id}"
name = "www"
type = "cname"
ttl = "300"
records = ["${aws_elb.cloudelb.dns_name}"]
}
Plan and apply your Terraform to get your new CNAME record:

You will notice that your WordPress is still responding. The canonical name record allows us to point one DNS record at another. Using this pointer, AWS can scale our load balancer (LTM) up and down without us worrying about the ever-changing IP addresses. We can do the same thing with our service instances.
- Linux設(shè)備驅(qū)動開發(fā)詳解:基于最新的Linux4.0內(nèi)核
- Kubernetes修煉手冊
- Windows Phone應(yīng)用程序開發(fā)
- Windows Vista融會貫通
- Windows 7中文版從入門到精通(修訂版)
- 嵌入式系統(tǒng)原理及開發(fā)
- Mastering Reactive JavaScript
- Linux網(wǎng)絡(luò)操作系統(tǒng)項目教程(RHEL 7.4/CentOS 7.4)(第3版)(微課版)
- Hadoop Real-World Solutions Cookbook
- CSS揭秘
- OpenSolaris系統(tǒng)管理
- SQL Server on Azure Virtual Machines
- 微信小程序項目開發(fā)實戰(zhàn):用WePY、mpvue、Taro打造高效的小程序
- OpenStack Trove Essentials
- Linux操作系統(tǒng)實用教程