Thursday, May 29, 2008

Application Deployment on EC2 made easier using Smart EC2 Tool

Those who have worked on EC2 must be familiar with the deployment issues, due to the dynamic nature of the EC2 environment. Since we have been working with EC2 for a long time, we have come up with a tool to manage our application deployment using ANT(ANT is a build tool hosted in APACHE projects) and we are sure that the rest of the world can also use it.

This tool is generic enough to be used in a non EC2 environment, but in this article, we focus only on EC2.

About SmartEC2 Tool

This tool has bunch of ant tasks which can be used in the EC2 environment.

BaseTask - This is the base for all the other tasks. Has a method to save files to a given location.

S3Download - Helps to download objects from S3 buckets. This tool uses Jets3t for this task.

HttpDownload - Simple HTTP file download task. It does not support HTTPS and HTTP based authentication. Used only for public URL's.

MetadataDownload - This downloads all metadata related to the instance and stores it as a property file in the given location. EC2 Meta data is available as a tree structure. This task downloads all the metadata in one short and makes it available as a linear property file.

A typical EC2 Metadata request would provide the following list.
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
instance-id
instance-type
local-hostname
local-ipv4
placement/
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups


The translated Metadata file contains data in the following fashion.


ami-id = ami-sdfes213
ami-launch-index = 0
ami-manifest-path = ?
block-device-mapping/0 = ?
block-device-mapping/1 = ?
hostname = ec2-67-202-43-212.compute-1.amazonaws.com
instance-id = i-qwewq132
instance-type = ?
local-hostname = ec2-67-202-43-212.compute-1.local
local-ipv4 = ?
public-hostname = ?
public-ipv4 = ?
public-keys/0 = sdfdsfsd-sdfsdf34543-#
reservation-id = ?



ReplaceProperty - This task helps you to replace any properties in the corresponding target file. At this point it can replace any one of the properties at a time.

Smart EC2 tool contains all of the tasks listed above and a default build.xml file.


<?xml version="1.0" encoding="UTF-8"?>

<project name="Ec2Ant" basedir="." default="execBuild">

<property name="localFolder" value="${basedir}"/>

<property name="s3buildPath" value="${localFolder}/s3build"/>

<property environment="env"/>

<path id="csslab.lib">

<fileset dir="lib">

<include name="**/*.jar"/>

</fileset>

</path>

<typedef name="s3download" classname="com.csslab.s3ant.s3.S3Download" classpathref="csslab.lib"/>

<typedef name="HttpDownload" classname="com.csslab.s3ant.core.HttpDownload" classpathref="csslab.lib"/>

<typedef name="ec2metadata" classname="com.csslab.ec2.MetadataDownload" classpathref="csslab.lib"/>

<typedef name="replaceproperty" classname="com.csslab.ec2.ReplaceProperty" classpathref="csslab.lib"/>

<target name="execBuild">

<mkdir dir="${s3buildPath}"/>

<echo>Using build path ${s3buildPath}</echo>

<HttpDownload fileUrl="http://169.254.169.254/1.0/user-data" localFolder="${s3buildPath}"/> <loadproperties srcFile="${s3buildPath}/user-data"/>

<s3download accessKey="${accessKey}" secretKey="${secretKey}" bucketName="${bucketName}" S3ObjectPath="${buildFile}" localFolder="${s3buildPath}" saveFileAs="build.xml"/><ant antfile="${s3buildPath}/build.xml" dir="${s3buildPath}" inheritrefs="true"/>

<delete dir="${s3buildPath}"/>

<echo>Build completed successfully.</echo>

</target>

</project>


First section contains declaration for some of the properties used by the targets.
Next you will find the definition for all the four ant tasks.
Then you will see a target that gets executed when the ANT starts.

Deploying Smart EC2 on your AMI
Pre-requisite
Please download the following pre-requisites.
  • JDK 1.5 or later from Sun
  • Ant 1.7 from Apache
  • Download Smart EC2 from here (http://smartec2.s3.amazonaws.com/SmartEC2.zip). Unzip the file and you will find a lib folder and a build.xml file.
  • Setup your path to point to the Java and ANT binaries.

    How does it work?
    EC2 has a provision to launch AMI's by providing user-defined data as an input file. The build process expects certain important parameters like Access Key, Secure Key, build file path and bucket name where the build file is available. The user defined data should be in the below given format. The key names listed below are mandatory. But you are free to add your own keys for further build process.


    accessKey={your access Key}
    secretKey={your secret key}
    bucketName={your bucket name}
    buildFile={your build file path}


    A typical user-defined data file looks like the below one.

    accessKey=aaaaa2323123bcv
    secretKey=sce3434343#$$$$vvxcvx/sdfsdfs
    bucketName=mybucket
    buildFile=mybuild.xml


    Download the sample user data file here and store it locally. But you need to replace properties with the appropriate values.
    You can use putty to login to the instance once it is launched and change your directory to where you have installed Smart EC2. For the first time users, you need to install the tool and bundle your AMI. If you are not familiar with building AMI’s , you can use our Jboss AMI which is available for public. Please find the URL below.
    http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1450
    Let’s assume you have installed Smart EC2 under /var/local. This is where the tool is installed on the above mentioned AMI.
    You will use the following command to go to the tools home.
    Cd /var/local/SmartEC2
    Execute the command ant.
    This will download the user defined data from the EC2 server and make it available as ANT properties. And then it will download the build file created by you for your project and executes it.

    How can you benefit out of this?
    As we know ant has a wide variety of tasks which can ease your deployment process such as executing shell scripts, deploying war, ear files on to the container etc. So sky is the limit.
    We have created couple of sample build files(Sample1 , Sample2) in our S3 bucket for your reference as well.
    Subscribe to this user group to get more updates.
    You can download the source and build on top of it.

    For your convenience we have created a step by step screen shots to showcase as how we deploy our applications using this solution.


    44 comments:

    Anonymous said...

    Great article you got here. I'd like to read a bit more about this topic.
    BTW check the design I've made myself London escorts

    Anonymous said...

    Great story you public here.
    It will be intresting to read anything more concerning this article.
    Thanks for giving that information.
    With best regards Anna
    Kiev escort

    gfe kiev escort said...

    Its really a great post, the content is impressive I'm feeling grateful to read this post and got to know how many things happened at that point of time.

    Aravind said...

    Hi,
    Nice tool...Can this be applied to Windows environment as well?

    hard drive data recovery cost said...

    Wonderful post - I was looking for a similar article. Thanks for sharing this article to your reader. You give very nice information about this subject.

    hallsarah204@gmail.com said...

    I though that it will be impossible for me to understand all of this; but after reading your post< I finally got it! Hire a resume writer helper in order to receive a detailed but concise resume within the shortest period of time!

    Richard Majece said...

    It will be useful for college students to check https://domyhomework.guru/blog/compare-and-contrast-essay-topics out before writing compare and contrast essay. Here you can find out more about topics

    Allie009 said...

    It’s not like AP classes are a course series or that if you take one you take them all. For example, I wanted to take AP US History my junior year Custom Assignment Writing Services, and I signed up for the class, but no other AP courses that year. I subsequently dropped APUSH, and signed up for AP Chem instead.

    Scott Stayris said...

    I admire this article for the well-researched content and excellent wording. QuickBooks data transfer utility allows users to quickly and easily transfer data from one QuickBooks file to another file.

    Dakota Leest said...

    Admire the article. The post is well-structured and cognitive. Wheredo you usually look for ideas for writing? I am also a writer at the company https://essays-writer.net/articles-for-sale.html . I run out of ideas.

    John Fei said...

    Ruby on rails (or in no time RoR) is an innovation intended for web application development. In the same way as other programming dialects, it is a universally useful yet in addition simple to-utilize structure working under the permit of MIT. The interest for RoR can be disclosed by its idiosyncrasy to work on show instead of arrangement. Subsequently, developers don't invest bunches of energy on record design in this manner the development interaction is a lot quicker. Numerous organizations that require RoR developers, allude to offshore administrations to discover proficient experts everywhere on the world. Ruby on Rails is regularly considered as a beginning stage for programming, as it is adaptable and permits novices to acquire their programming experience without any problem. How about we perceive how Ruby on Rails development outsourcing benefits the new companies. Offshore administrations surmise tracking down the best answer for meet your specialized requirements everywhere on the world. With a huge measure of offshore RoR firms, offices, organizations you can track down your best match in any world's part. Offshore ruby rails development benefits don't just allude to new businesses, so we should perceive how huge organizations and SMEs win with offshore RoR innovation. Mobilunity is a Ukrainian-based supplier of committed software development teams with more than 9 years of involvement with nearshoring and customers spread across the world. From huge ventures to new companies, we are anxious to convey top Ukrainian experts to meet your specialized necessities and add creative answers for your business. We have an enormous pool of gifts that will apply their aptitude in DevOps, Java, Python,and numerous different advancements and furthermore convey Ruby on Rails offshoring administrations to make a forefront imaginative item.

    Anna Green said...

    Do you know how to create an online marketplace mvp and succeed? I want to build a marketplace, but do not know from where to start. Do you have some advices ot tips? Thanks.

    Unknown said...

    post a comment on Immigration SG

    Education said...

    The best part of your article is the chosen resources. Information matches the standard of the article. Thanks for sharing. If you are looking for experts who can write your assignments, contact SourceEssay based homework help team anytime.

    Safi said...

    I am happy that I observed this blog, just the right information that I was searching for! PSL Super League

    Jewell J. Nguyen said...

    In order to make better sounding voice assistants, chatboxes and other types of NLP technology, the software needs training and it needs to be labeled properly by a professional. This is what an audio labeler does. A professional that listens to audio, transcribes it and labels the data so that the system can better understand what it is listening to. Here we will take a look at what it is like to be an annotation file , how much it pays and exactly how the process works in order to create better technology.

    james said...

    Need Programming Homework Help? We provide Programming assignment help service in Java, Python, C, C#, Php, C++, Databases, SQL, Android or iOS.For more info- Get Assignment Help Online.

    TAZEEN said...

    Technologistan is the popoular and most trustworthy resource for technology, telecom, business and auto news in Pakistan
    iesco duplicate online bill

    jhon wicky said...

    That is really an great colourist logo

    jhon wicky said...

    How that is an good site like Big sustainability

    NathanPass said...

    Hello! If your company needs higher accuracy in labeling and categorizing data, then I would like to recommend you to use the services of our company. Our company has been providing the services of the best data markers for many years and will help you landmark annotation. Hiring a remote data marker has never been easier!

    WaldoEffertz said...

    Hey! Each business should have its own page in social networks to promote their product. hire a social media manager so that a person who knows how to work with the audience would be engaged in maintaining your page, thereby advertising and adding a good impression about your product.

    NathanPass said...

    Hello! Recruitment is a difficult task, but you can always use the services of our agency! Our IT support services provide recruitment services. We offer you only competitive prices and in turn provide only professional services. Contact us right now if you need help with the selection of candidates! see this here

    WaldoEffertz said...

    Is your artificial intelligence related to audio? To help your AI learn faster and more accurately, you need an audio labeler. Our company provides data descriptors of any direction! You can be sure that with our specialists, the quality of information for AI will be on top!

    DarenTill said...

    Hello! This information will be useful for those who need help with software development. Software development is an important part of any business these days. However, new challenges arise from time to time, forcing companies to adapt. use the help of our company to perform the assigned tasks with high quality. Our company will promptly complete all tasks. So if you're looking to cut costs and eliminate risk on your project, agile nearshoring might be the right choice for you. Just try it, hundreds of companies that have already chosen it can't be wrong. more info here

    WaldoEffertz said...

    Do you have a job that takes a lot of time to complete and you are sure that it can be automated with the help of cloud computing consulting firms, but you are stopped by the problem of selecting qualified developers and the price for this work? Our specialists will select suitable engineers and implement your idea. The selection of developers is carried out in Ukraine, there are very qualified engineers and the price for their services is several times lower than in other countries.

    NathanPass said...

    When choosing a good React developer, the first thing you look at is their CV, but it's not always clear what skills a candidate needs to have to properly implement your application. We have selected hundreds of cool React developers for all kinds of projects and we know what a resume of a candidate should look like who will understand your desire as accurately as possible. hire dedicated react js developer

    WaldoEffertz said...

    Hey! Technical support for your business is a very important component! Customers using your product expect to get it working correctly and leave a good impression about your product. bpo ukraine will help you deal with it! Each specialist will fully understand the concept of your product!

    WaldoEffertz said...

    Hey! When faced with problems in maintaining communication with customers and solving their problems, you may need qualified remote contact center agents to solve them. To save on those, and to be sure of their competence, I advise you to explore more and contact us!

    WaldoEffertz said...

    Hello! Do you have an idea for a cool AI, but need large amounts of high-quality information that is suitable for learning? Our data labeling for startups specialists will be able to prepare information of any direction and type.read this post here for more detailed information on why it is profitable to cooperate with us!

    Harry Jhons said...

    This is an amazing post.


    Qdexi Technology provides you assistance in the Google Adwords Service , by increasing your awareness, increasing your engagement, and improving brand perception.

    My Assignment Experts said...

    Alex is a well-known academic author from the US who blogs sometimes. He is a proud member of Myassignmentexperts.com and is well-known for helping students with their Assignment help online. You are welcome to call her at any moment if you need unmatched support.
    help with java assignment

    Essien said...

    Is a splendor updates! Thanks for the shared; I appreciate you for this fantastic ideas with with us. Its a nice time coming your around. I admire your efforts for sharing. aau cut off mark for mathematics

    Essien said...
    This comment has been removed by the author.
    NefallisMarian said...

    Forget about the monotonous search for employees that does not bring results - after all, this resource and its professionals with many years of experience will do everything for you and find the best candidates for almost any IT position. Follow the link startup staffing agency and try on all the benefits for yourself now!

    NathanPass said...

    Hello! Our outsourcing company will help you pipedrive client onboarding. After all, PipeDrive customer support is a great CRM that is focused on the sales funnel, and together with us you can achieve the best results of its use by hiring professional support specialists. More details on our website!

    NathanPass said...

    Hello! Looking through the offers of many recruiting consulting firms, you may not know which one to choose and whose services will be of really high quality. Our Distributed Recruiters agency has established itself as a reliable partner in the field of building a talent attraction team and we will help you hire the best specialists in a short time! >> recruiting consulting firms

    Unknown said...

    Do you dislike hiring specialists manually because it takes a lot of time and there is not enough budget for quality professionals? This site will help you solve this problem, because they specialize in hire dedicated ppc experts at good prices, and they are also pleased with the hiring speed, which is on top!

    Unknown said...

    This team providers offer a range of services, including IT support, back-office operations, data entry, and much more. The BPO industry in Ukraine is home to a large pool of multilingual professionals who can provide customer service in a variety of languages, making it an excellent choice for businesses with a global reach. If you have a desire to work with software development staff augmentation and rise to a higher level,then do not waste time.

    Assignment Writing Service said...
    This comment has been removed by the author.
    Assignment Writing Service said...

    Great article you got here . Check out the Global assignment help An assignment writing service tailored exclusively for international students. Our expert will generate the most unique, researched based work following the board rules. Avail our service to unlock more amazing benefits.

    Devin Steffan said...

    You have to follow some easy steps for hiring experts through GotoAssignmentHelp’s Do My Business Assignment service. First, share your requirements and every detail about your assignments. Then make payment and you will get your complete solution paper. Before delivering, the assignments are checked many times by the proofreaders. They check spelling mistakes, grammatical errors, sentence formation, paragraph formation, etc. You can make payments via PayPal, VISA, MasterCard, Maestro, American Express, DISCOVER, etc. there are no hidden charges here. You can visit the official website of GotoAssignmentHelp if you want more information about this service.

    Read more – Transition Words for Essay

    Belly Amy said...

    Rasmalai cakes in chandigarh, mohali, kharar, zirakpur and panchkula.

    Ava Smith said...

    Thanks. If you are looking for Essay Writing Help from top usa experts, we can help you, contact us.