官术网_书友最值得收藏!

Global Traffic Manager

In this case, we will use a DNS record to point at the public IP addresses of both instances. This creates a Global Traffic Manager (GTM) service in front of them by adding this to the bottom of main.tf:

# Global Traffic Management using DNS
resource "aws_route53_record" "www" {
zone_id = "${aws_route53_zone.book.zone_id}"
name = "www.book.cloudpatterns.cuk"
type = "A"
ttl = "300"
records = [
"${aws_instance.cheap_worker.public_ip}",
"${aws_instance.cheap_worker_west.public_ip}"
]
}

Run your terraform plan command and then terraform apply -auto-approve (since I'm getting tired of typing yes at the prompt). You should see an instance running in each region and a new DNS record in Route 53. Let's try to access the https://www.book.cloudpatterns.uk URL. The Bitnami image listens on port 80 and 443 by default, but you can't get to them! We need to allow inbound traffic on the HTTP(S) ports. Let's create our first security groups. We want one in each region—use vpc.tf for this:

resource "aws_default_security_group" "default" {
vpc_id = "${aws_vpc.mainvpc.id}"

ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
---------------------------------------------------------------------

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

resource "aws_default_security_group" "default_west" {
vpc_id = "${aws_vpc.mainvpc_west.id}"
provider = "aws.west"

ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

-----------------------------------------------------------------------

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

Chapter 4Security - Ensuring the Integrity of Your Systems, will explain what's happening in that code. Re-run your plan and apply it. Refresh your browser and you should see the welcome screen:

Now you have a globally distributed WordPress deployment. Unfortunately, you have to wait until the Persistence Patterns section for us to be able to keep the data synchronized.

To deliver content to end users with lower latency, Amazon CloudFront uses a global network of 136 Points of Presence (125 Edge Locations and 11 Regional Edge Caches) in 62 cities across 29 countries (correct at time of writing). Lambda Edge Functions also take advantage of these local POPs.

主站蜘蛛池模板: 东丽区| 鄯善县| 旬阳县| 云阳县| 舒城县| 策勒县| 乌鲁木齐县| 德安县| 宜城市| 进贤县| 盱眙县| 龙海市| 香格里拉县| 宜兰县| 伊金霍洛旗| 城市| 山西省| 山丹县| 柳江县| 六枝特区| 屏东市| 乐业县| 长治县| 长寿区| 滁州市| 定边县| 故城县| 甘肃省| 红原县| 卫辉市| 康平县| 扎囊县| 如皋市| 浪卡子县| 德化县| 萨迦县| 灵寿县| 宝兴县| 杭锦旗| 南陵县| 万载县|