How to migrate domains between 2 AWS accounts on Route53

I had an interesting problem to solve yesterday. Essentially I needed to migrate a domain (ie. hosted zone) from one AWS account to another. This isn’t an all-together complicated act, however the biggest problem is migrating the DNS records – particularly if you have a lot of them.

Unsurprisingly, the AWS console makes no attempt at allowing you to export and import a common format of zone file (in fact there’s no export at all). I figured, surely this would be possible using the cli tools… however unfortunately that is not very straightforward.

It is possible to export DNS records for a domain using the aws cli, and it is possible to import them as well, however the structure of the 2 files is a bit different (almost like the two functions were designed by 2 entirely separate teams, who were competing or something!). So what I did was write a simple PHP cli script to convert from the export format to the import format.

To do this process, I recommend you set up profiles for both accounts in your ~/.aws/credentials file. Then follow the following steps;

Instructions

Firstly, for both accounts, get the hosted domain zone ID. You can do it using the following command:

You want the 12-16 character alphanumeric ID of the zone associated with the relevant domain name. Change the zone ID in the following examples as necessary.

Then on the source account, you want to export all DNS records with the following aws cli command, which puts them into a file called “source-records” in the current directory.

Now you want to manually edit that file, and just delete the 2 entries equivilent to the default ones AWS adds for every new domain – the nameservers and root SOA record for the domain. Because these exist already in the new domain route53 setup and are different to the old ones, you do not want to import them. Since this is much simpler to do visually, I didn’t want to bother automating this in the script.

Then, run the converter script on that file.

And then, use the aws cli to import the converted file into the new zone (note this assumes again that the record file is in the current directory)

All done! Really hope this helps someone, as I couldn’t find any guide on how to do this online.

My Laravel meetup presentation – modern components in old codebases

On Tuesday, me and a colleague are going to do a presentation at the Sydney laravel meetup, where we will talk about our learnings of embedding a multitude of laravel (and other modern) components in an old codebase.

This is very useful for anyone either working on older projects or maintaining an old project, as you can take and use some of the best features of Laravel even in the worst codebases. If you’re anything like me, the concept of not having laravel is a scary one, so come along and learn from our experiences!

Meetup event

Update:
You can see the slides for the presentation here.

Great AWS Summit

Me and a few colleagues attended the AWS 2017 Summit in Sydney earlier this week. It was a pretty cool event – even if a bit packed on the first day.

Not only were there a lot of interesting things to learn, but I also found out about some AWS vendors which could quite potentially be very useful for some of our clients.

All around, really great event. Especially the brownies.

Chrome 56 : Gamechanger for SSL

If your website has any forms related to payment or login, Google Chrome will start to present a warning to it’s users when they browse the website.

This is quite a game-changer, because the traditional rule-of-thumb is that you should use SSL when payment details are accepted, but not necessarily for any other reason (this is for your run-of-the-mill sites of course).

This might have been an unprecedented inconvenience for a huge amount of website maintainers and a huge boon for SSL sellers – however luckily Lets Encrypt has come onto the scene recently, and has now matured to a point where it’s proven to be highly reliable and robust.

I’m using it for most of my websites which do require any sort of SSL (such as this very blog!), and I highly recommend everyone who doesn’t use SSL, and is worried about the implications of this, to start using Lets Encrypt.

Sydney Rides Business Challenge

We at 4mation Technologies are a healthy bunch, in fact a large portion of us ride our bikes to work. With that in mind, it was an easy decision to enter ourselves in the Sydney Rides Business Challenge – an event lasting about 4 weeks, designed to get people in the business world riding their bikes to commute to work. We entered as a company of 50-199 staff, and my team within the company also entered as a department of 3-6 people.

As it turned out, we did pretty well! Here are some results that I captured near the very end of the competition;

4m-overall

4m-advtech

And I’m very proud to say that our team (within the company) actually came 1st in the department rankings for Sydney. We got to attend the award ceremony at the Hilton with some nice appetizers and alcohol, and the Major gave us these;

bike-award

All in all, I’m pretty happy with our performance.

Stack Overflow Developer Survey 2015

Stack Overflow just did their developer survey for the year, and there’s some interesting stuff. There’s also a lot of expected stuff… for example, very relevant to my industry, WordPress remains one of the most dreaded technologies.

Overall, developers are relatively an inexperienced bunch compared to other engineering disciplines (this is however nothing new). Javascript is the most popular technology. Everyone seems to LOVE Swift.

Compensation by Industry is very interesting – I wish they had figures for Australia. I kind of feel as though the US ones are skewed heavily by parts of California like the Bay Area where the cost of living is outrageous (hence the salaries are too). Australia is 4th best compensated, and there is actually little difference between it, US and Russia (amazing right?) according to the big max index of PPP salaries. The best remunerated country according to the same scale happens to be Ukarine. Salary rises with stack overflow rep (bit of self serving commentary, but I guess it’s well placed).

The weightings of different industry sectors in different parts of the world is rather intriguing, I’m guessing the US has a disproportionate amount of tech startups, and of course Asia has a disproortionate amount of traditional software engineering products.

People in Iran, are the most satisfied with their development jobs.

Overall, lots of cool statistics – I recommend you check it now.

Working with Beanstalk Queues

Queueing is a natural part of modern web applications. Without it, you will end up with a poor user experience due to unnecessary execution blocking leading to inadequate response times. In Laravel (which everyone is using, of course), one of the easiest providers to get going with queues is beanstalkd. You can set it up in 15 seconds on any linux distro – and away you go without any configuration necessary. However when you need to debug and investigate, it isn’t really clear how to proceed. As such, I wanted to quickly go over some tools that I’ve discovered which are very helpful.

CLI based tube inspection

If all you have is a CLI, and you want a hassle-free way to check your tubes, I highly recommend beanstool. With no setup necessary, it will quickly give you all the info you need.

Web based tube inspector

If you need a GUI and/or more detail, then beanstalk console has you covered. It’s a very simple and lightweight PHP application which will give you plenty of info, and allow you to quickly and efficiently go through your tubes if they are clogged with several jobs.

Clear a queue in Laravel

This is perhaps the single most useful one. The scenario is that you have hundreds or thousands of faulty jobs stuck in your queue, and you want to quickly clear all of them. Amazingly, there is no trivial out-of-the-box way to do that, so I’ve come up with the following Laravel Command to get that job done.

PHP Conference 2015

I’ve just attended the PHP Australia conference on the 12th and 13th of March. This was my first ever actual full blown conference in anything, and I have to say, it was pretty amazing. Apart from the creators of PHP and MySQL (now working on MariaDB of course), there was an awesome list of speakers and lots of great food. This is probably a good time to give Seb kudos for managing to organise such a packed event.

I’ve been compiling notes for work (props to 4mation for paying for my ticket), and so far I have almost 4 pages, which is pretty cool. There are so many takeaways, it seems pointless to even try to get into them, however I will say that talking to Rasmus and Monty was by far the highlight of the two days. Lesser so, it was also interesting to discuss technologies in use with people from all around Australia, what their stack is, and how they go about development.

The Value of Learning

Today at work, at our Monday general meeting, I gave a brief speech about my take on our value of Learning… so why not also share it with the world?

I believe that no other industry other than ours is so fast paced in terms of the technology needed to accomplish our jobs. Something which might be relevant one year, will be shunned and largely disused the next. Every week there is a new acronym for a new developer tool, every month there is an update to a framework we use. Development paradigms are always changing.

In short, if we are to excell above our competitors, we must truly embrace all facets of the learning process. We quite simply don’t have the right to call ourselves professionals without fully exhausting all the avenues we have at our disposal to learn new things.

These will come in the form of online seminars, meetup groups and conferences, discussing projects with colleages, work outside of work, always helping people – on stack overflow, forums and IRC, hours and hours of reading online documentation at midnight, and a good old fashioned book or two.

The media and news programs always report that our profession has benefits and culture which is the envy of every worker on the planet. I for one believe we should work hard to earn this place of ours in the world.