DZone
Cloud Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Cloud Zone > How I Created an Amazon AMI for Faster Deployments

How I Created an Amazon AMI for Faster Deployments

Nick Jordan user avatar by
Nick Jordan
·
Aug. 09, 12 · Cloud Zone · Interview
Like (0)
Save
Tweet
5.36K Views

Join the DZone community and get the full member experience.

Join For Free

The content of this article was originally written by Reed Law on the Smashing Boxes blog.

Chef is a great tool for automating deployment. But the bootstrap process is hard to get right. Sometimes it can just be easier to start with a system that’s already configured close to your needs.

Setup

  • 64-bit 2011.09 Amazon Linux with EBS boot
  • Nginx latest stable
  • Ruby 1.9.3

First launch an instance from the AWS Management Console. I am using amzn-ami-2011.09.2.x86_64-ebs (ami-1b814f72) as the image.

$ ssh ~/.ec2/yourkey ec2-user@ec2-12-34-56-78.compute-1.amazonaws.com
$ sudo su
$ yum update -y
$ yum install -y openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel pcre-devel
$ wget http://nginx.org/download/nginx-1.0.14.tar.gz
$ tar xvzf nginx-1.0.14.tar.gz
$ cd nginx-1.0.14
$ ./configure --sbin-path=/usr/local/sbin --with-http_ssl_module
$ make
$ make install

Now you will probably want an init script. This Slicehost article is a bit old but still works beautifully. Start at the “Init Script” section.

Now for ruby, install yaml for psych, and then compile ruby from source:

$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar xzvf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4
$ ./configure --prefix=/usr/local
$ make && make install
$ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
$ tar xvzf ruby-1.9.3-p125.tar.gz
$ cd ruby-1.9.3-p125
$ ./configure --prefix=/usr/local --disable-install-doc --with-opt-dir=/usr/local/lib
$ make && make install
$ /usr/local/bin/gem install bundler

Now clean up:

$ rm -rf ruby* nginx* yaml*
$ cd /var/log
$ > cron
$ > maillog 
$ > secure
$ > spooler 
$ > yum.log 
$ rm ~/.bash_history
$ exit

Now we’re ready to create the image. Right click on the EC2 instance in the AWS control panel and choose “Create Image (EBS AMI)”. Give it a name and description and then click “create”. Now choose the AMIs tab on the left. You should see the new AMI in the “pending” status.

 

 

 

 

Amazon Machine Image

Published at DZone with permission of Nick Jordan. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The Differences You Should Know About Java and Python
  • GitHub Events Are Booming! Are Bots the Reason?
  • A BGP Guide for the Non-Network Engineer
  • Apache Kafka in Crypto and Finserv for Cybersecurity and Fraud Detection

Comments

Cloud Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo