Monthly Archives: August 2014

[Waze] Canili and Diayo Dam

Screen Shot 2014-08-24 at 5.47.18 AM

A few weeks back, when I was planning and checking our route to Baler in Waze, I saw these high density of URs (update requests) in one area which sparked my interest. After driving to Baler, I know what it is now – It’s the Canili and Diayo Dam. Fortunately, SMART has data on this location, so I fired up URs to mark the start and end points of the dam so I can add it.

Please note that this stretch is one-way, depending on which side has incoming traffic first.

Sabang Beach coastline

We stayed in one of the places in Baler along Sabang beach. So yes, route suggestions via Waze to Baler is working flawlessly now 🙂

[HowTo] AWS Route 53 domain failover to a static site hosted in S3

We have this big website that’s currently being overhauled (means: new architecture, new tech stack and totally new code from the ground up). The lead dev asked our team if we can redirect traffic to a static site in case the actual site is down.

[Update: Our site is now launched! It’s still in beta. Check it out here: https://new.smartnet.ph]

I only overheard this but I jumped in to help because I’ve been wanting to try this feature of Route 53 but didn’t have the chance to really implement it.

I figured that that there should be a lot of tutorials on how to do this already… so this should be a walk in the park.

A little help from Google lead me to a few sites. This one is a good tutorial if you only want to redirect to different IP (steps are listed and screenshots!).

I didn’t find a good tutorial as far as aliases are involved. And we’re stuck with this loading screen:

Screen Shot 2014-08-19 at 8.10.57 AM

Not really a walk in the park…

With that good tutorial  as reference, we (with help from John) decided to have a crack at this ourselves.

Note: This guide assumes that your domain is already hosted in Route 53, if not you must move it first.

This how we did it:

  1. create a static site hosted in S3 [how?] – skip Step 3
  2. create your route 53 health checks [how?] – replace Step 8 with the steps below

Create a secondary alias failover using AWS CLI:

  • get the Hosted zone ID of your S3 endpoint [here] – In our case we’re using Singapore so hosted id is Z3O0J2DXBE1FTB
  • get the Hosted zone ID of your domain [how?] – in this guide, let’s assume that mysite.ph has a zone id of ABCDE12345
  • create a json file like below:
  • serenity:~ deadlockprocess$ cat ~/tmp/mysite.ph.json
    {
      "Comment": "mysite.ph failover",
      "Changes": [
        {
          "Action": "CREATE",
          "ResourceRecordSet": {
            "Name": "mysite.ph",
            "Type": "A",
            "SetIdentifier": "mysite.ph-secondary",
            "Failover": "SECONDARY",
            "AliasTarget": {
              "HostedZoneId": "Z3O0J2DXBE1FTB",
              "DNSName": "s3-website-ap-southeast-1.amazonaws.com",
              "EvaluateTargetHealth": false
            }
          }
        }
      ]
    }
  • add the failover alias as a new record set in Route 53 with this command:
  • serenity:~ deadlockprocess$ aws route53 change-resource-record-sets --hosted-zone-id ABCDE12345 --change-batch file:///Users/deadlockprocess/tmp/mysite.ph.json
  • you can now go back to this guide and do Step 9 onwards
  • also, allow the Route 53 Health Checkers’ IPs in your firewall/security group

References: