background preloader

AWS Best Practices

Facebook Twitter

AWS EC2 cloud automation tricks that will amaze you. Nick Hardiman uses cloud-init to do clever cloud instance initialization things when firing up a new Amazon Web Services EC2 machine.

AWS EC2 cloud automation tricks that will amaze you

I'm automating a simple web service. Using the new Amazon Web Services (AWS) Command Line Interface (CLI) tools, I will build two Amazon EC2 machines before your eyes! One machine hosts a Puppet master and the other hosts a puppet agent and Apache. I'm using some cloud automation tricks. I use cloud-init to create a Puppet master service, and then the Puppet master will create the Apache service. I put the instructions (the cloud-config data) in these two files. p-master-user-data.yml - cloud-init information for my Puppet master. p-agent-user-data.yml - cloud-init information for my Puppet agent. Ubuntu uses an application called cloud-init to prepare a new cloud machine for use.

The ephemeral drive /dev/xdb2 If you have started an Ubuntu-based cloud machine, you may have already noticed one of the things that cloud-init does. The cloud-config data version #! EC2 and Ubuntu - Alestic.com. Moving an EC2 Instance to a Larger (or Smaller) Instance Type. When you discover that the entry level t1.micro instance size is simply not cutting it for your growing application needs, you may want to try upgrading it to a larger instance type, perhaps an m1.small or even a c1.medium.

Moving an EC2 Instance to a Larger (or Smaller) Instance Type

Instead of starting a new instance and having to configure it from scratch, you may be able to simply resize the existing instance by asking Amazon move it to better hardware for you. Of course, since this is AWS, you don’t have to actually talk to anybody—just type a few commands and the job is done automatically. Constraints Before you try this approach, note that there are some conditions:

Rebooting vs. Stop/Start of Amazon EC2 Instance. When you reboot a physical computer at your desk it is very similar to shutting down the system, and booting it back up.

Rebooting vs. Stop/Start of Amazon EC2 Instance

With Amazon EC2, rebooting an instance is much the same as with a local physical computer, but a stop/start differs in a few keys ways that may cause some problems and definitely have some benefits. When you stop an EBS boot instance you are giving up the physical hardware that the server was running on and EC2 is free to start somebody else’s instance there. Your EBS boot volume (and other attached EBS volumes) are still preserved, though they aren’t really tied to a physical or virtual server. They are just associated with an instance id that isn’t running anywhere.

When you start the instance again, EC2 picks some hardware to run it on, ties in the EBS volume(s) and boots it up again. Things that change when you stop/start include: New internal IP address, though could randomly be the same. Cloud, Big Data and Mobile: 25 Best Practice Tips for architecting your Amazon VPC. AWS Tips I Wish I'd Known Before I Started - W(e)blinks. Moving from physical servers to the "cloud" involves a paradigm shift in thinking.

AWS Tips I Wish I'd Known Before I Started - W(e)blinks

Generally in a physical environment you care about each invididual host; they each have their own static IP, you probably monitor them individually, and if one goes down you have to get it back up ASAP. You might think you can just move this infrastructure to AWS and start getting the benefits of the "cloud" straight away. Unfortunately, it's not quite that easy (believe me, I tried). You need think differently when it comes to AWS, and it's not always obvious what needs to be done. So, inspired by Sehrope Sarkuni's recent post, here's a collection of AWS tips I wish someone had told me when I was starting out.

Application Development Store no application state on your servers. Edit: For S3 uploads, HN user krallin pointed out that you can bypass your server entirely and use pre-signed URLs to let your users upload directly to S3. Store extra information in your logs.