Tuesday, June 23, 2015

Teach a man to fish ...

Today somebody asked me a question which I thought warranted a blog post. For the purpose of this blog post "somebody" will be referred to as Jeff.

So, Jeff came to me with a problem. Jeff had set out to build a particular solution in AWS. During his investigations he found an off-the-shelf CloudFormation template which deployed the exact solution he wanted.

Jeff downloaded the CloudFormation template from GitHub, logged in to the the AWS management console and ran through the "Create new Stack" wizard. Jeff was on top of the world, the solution was being built in front of his very eyes and so far, all he'd had to do was a bit of googling and a few mouse clicks.

He was grinning like a cheshire cat, life was good, CloudFormation was working it's magic and he was going to be the office hero ... right up until the moment he saw the dreaded ROLLBACK_IN_PROGRESS message.

S**! Jeff thought to himself as he watched his beautiful solution torn down, volume-by-volume, instance-by-instance, ELB-by-ELB.

He opened up the CloudFormation template using his trusted copy of Sublime and this is what he saw:

"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos."

Well, he didn't really see that, but I'm sure you can appreciate that to the untrained eye, CloudFormation templates can definitely look a little scary.

That's when Jeff decided to call me and ask for a little help. We walked through the template and tried to identify the reasons for the failure, which are beyond the scope of this post. One thing which did become clear from the silence on the other end of the line was that Jeff was struggling a little bit to keep up with my troubleshooting approach, how did we get from Error Message A to Solution B.

Jeff then reminded me of the famous quote "Give a man a fish and you feed him for a day, teach him how to fish and you teach him for life".

Now, just to put a little context around my friend Jeff, he's a very smart developer. It would not take Jeff long to "learn how to fish". But, what were the best resources to help Jeff "learn to fish".

AWS have an awesome documentation library and below I've included a few of the, in my personal opinion, best links for getting to grips with CloudFormation.

This first link is a great starting point for anyone wanting to start out with CloudFormation and understand the building blocks of a template:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html

This next link is a the bible of AWS CloudFormation resources. It provides an invaluable breakdown of every resource type you can create through CloudFormation. Definitely my first stop when handcrafting and troubleshooting templates.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html

I'm sure I'll hear from Jeff again. But I know that armed with new arsenal of new links, he will try his absolute best to catch that fish on his own first. He may not succeed, but he will learn a lot and with each attempt, this;

"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos."

Will start to look more like this;

  "Resources" : {
    "EC2Instance" : {
      "Type" : "AWS::EC2::Instance",
      "Properties" : {
        "InstanceType" : { "Ref" : "InstanceType" },
        "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
        "KeyName" : { "Ref" : "KeyName" },
        "ImageId" : "ami-2323232"
      }
    },

No comments:

A little about Me

My photo
My name is Mitch Beaumont and I've been a technology professional since 1999. I began my career working as a desk-side support engineer for a medical devices company in a small town in the middle of England (Ashby De La Zouch). I then joined IBM Global Services where I began specialising in customer projects which were based on and around Citrix technologies. Following a couple of very enjoyable years with IBM I relocated to London to work as a system operations engineer for a large law firm where I responsible for the day to day operations and development of the firms global Citrix infrastructure. In 2006 I was offered a position in Sydney, Australia. Since then I've had the privilege of working for and with a number of companies in various technology roles including as a Solutions Architect and Technical team leader.