DZone
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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

How I Created an Amazon AMI for Faster Deployments

Nick Jordan user avatar by
Nick Jordan
·
Aug. 09, 12 · Interview
Like (0)
Save
Tweet
Share
5.47K 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

  • How To Get Page Source in Selenium Using Python
  • Streamlining Your Workflow With the Jenkins HTTP Request Plugin: A Guide to Replacing CURL in Scripts
  • Spring Cloud: How To Deal With Microservice Configuration (Part 1)
  • Java Development Trends 2023

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • 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: