<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>My AWS Musings</title>
	<atom:link href="http://aws-musings.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://aws-musings.com</link>
	<description>Cloud computing, EC2, RDS, SQS, S3, Java...</description>
	<lastBuildDate>Mon, 02 Aug 2010 00:22:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>7 Tips for running HBase in EC2</title>
		<link>http://aws-musings.com/7-tips-for-running-hbase-in-ec2/</link>
		<comments>http://aws-musings.com/7-tips-for-running-hbase-in-ec2/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 00:14:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EC2]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=323</guid>
		<description><![CDATA[We are running a HBase (Currently 0.20.4) cluster on ec2. I thought it will be useful for others to know some tips  about running HBase in EC2. 
1) Use private dns addresses in config files such as hdfs-site.xml, hbase-site.xml. On ec2 Ubuntu instances java&#8217;s getHost() gets resolved to the private dns addresses. 
2) Use [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gumgum.com">We</a> are running a <a href="http://hbase.apache.org/">HBase</a> (Currently 0.20.4) cluster on ec2. I thought it will be useful for others to know some tips  about running HBase in EC2. </p>
<p><strong>1) Use private dns addresses</strong> in config files such as hdfs-site.xml, hbase-site.xml. On ec2 Ubuntu instances java&#8217;s getHost() gets resolved to the private dns addresses. </p>
<p><strong>2) Use <a href="http://aws.amazon.com/ec2/instance-types/">c1.xlarge</a> or bigger node to start with. </strong>I have seen Andrew Purtell (HBase committer) recommending this on <a href="http://hbase.apache.org/mailing_lists.html">HBase mailing list</a>. We have tried m1.large machines. It has worked well for us when our traffic was small. We are hitting HBase in real time. As traffic started increasing we started getting CPU maxouts. Currently we use c1.xlarge machines.</p>
<p><strong>3) Define a security group for all of your Hadoop/HBase nodes.</strong> Hadoop, HBase, Zookeeper nodes need to talk with each other on many ports. It&#8217;s better to assign one security group to all the nodes and give that group permission to talk to it self.</p>
<p><strong>4) Use dfs.host property in hdfs-site.xml.</strong> This property allows you to specify a path of a file with a list of dns addresses of allowable nodes. Only nodes listed in the file will be allowed to join the Hadoop cluster. This becomes important in case you are spanning a QA cluster in ec2. You don&#8217;t want your QA node to join your production cluster accidentally. If you add a new node, you need execute the following command to refresh the allowable nodes list to avoid entire cluster restart:<br />
<code><br />
hadoop dfsadmin -refreshNodes<br />
</code><br />
I am assuming here that you are not running map reduce on the same cluster. If you want to run map reduce on the same cluster do not use a similar setting in mapred-site.xml. There is no refreshNodes option available for mradmin. It&#8217;s coming up in 0.21. </p>
<p><strong>5) Use EBS backed instances for a Hadoop/HBase nodes.</strong> There are many benefits of using EBS volumes instead of the s3 backed ones. For example, let&#8217;s say you tried a different vm args on a node to test the performance. And if the very same node goes down, you don&#8217;t have to worry about loosing those settings. All you need to do is take a snapshot of that volume and spawn an instance. I generally find it easier to deal with EBS backed instances than S3 backed instances. The added cost is too small in comparison with the added convenience of not loosing data.</p>
<p><strong>6) Prepare an AMI with Hadoop, HBase installation</strong> and with all the configurations. This will allow you to add a node quickly when you want to do so.</p>
<p><strong>7) Use Elastic Map Reduce to run map reduce jobs with your HBase.</strong> We have found this much more cost effective. Let&#8217;s say you have a 7 node HBase cluster. But your map reduce jobs need at least 10 nodes for it to finish on time. Elastic map reduce will allow you to spawn a 10 node job with your HBase. The load on your HBase cluster will reduce and you don&#8217;t have to pay for 3 extra nodes 24 x 7. Furthermore, you can spawn cheaper instances for your EMR job than you are using for your HBase (c1.xlarge) if you want to. We use c1.mediums.</p>
<p>HBase guys have written scripts to spawn a cluster in ec2. The scripts makes it easier to spawn an entire cluster. Don&#8217;t hesitate to try it out. Let me know if you have any other tips that you would like to share. I am sure many people are running their HBase clusters on ec2. I am eager to learn from their experiences.</p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/7-tips-for-running-hbase-in-ec2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Amazon&#8217;s new AWS java sdk sucks</title>
		<link>http://aws-musings.com/why-amazons-new-aws-java-sdk-sucks/</link>
		<comments>http://aws-musings.com/why-amazons-new-aws-java-sdk-sucks/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 00:48:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SDK]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=292</guid>
		<description><![CDATA[I am an ardent fan and user of Amazon&#8217;s AWS and that is the reason I don&#8217;t like their new API. Amazon has so far done a great job of making their services very intuitive, simple and easy to use. But somehow they forgot their principals while designing the sdk. In this post I am [...]]]></description>
			<content:encoded><![CDATA[<p>I am an ardent fan and user of Amazon&#8217;s AWS and that is the reason I don&#8217;t like their <a href="http://aws.amazon.com/sdkforjava/">new API</a>. Amazon has so far done a great job of making their services very intuitive, simple and easy to use. But somehow they forgot their principals while designing the sdk. In this post I am planning state my case.</p>
<p>Let&#8217;s discuss an example. The example is in groovy, but I am sure the code can be understood by everybody: </p>
<p>             <code><br />
                 def registerInstance(String instanceId, String loadBalancerName) {<br />
                 &nbsp;&nbsp;def request request = new RegisterInstancesWithLoadBalancerRequest()<br />
                 &nbsp;&nbsp;def server = new com.amazonaws.services.elasticloadbalancing.model.Instance()<br />
                 &nbsp;&nbsp;server.setInstanceId(instanceId)<br />
                 &nbsp;&nbsp;request = request.withInstances([server]).withLoadBalancerName(loadBalancerName)<br />
                 &nbsp;&nbsp;def client = new AmazonElasticLoadBalancingClient(awsCredentials)<br />
                 &nbsp;&nbsp;client.registerInstancesWithLoadBalancer(request)<br />
                 &nbsp;&nbsp;logger.info "${instance.getPublicDnsName()} registered with ${loadBalancerName} load balancer"<br />
             }<br />
</code></p>
<p>Above code simply registers a given instance with a load balancer. Now let&#8217;s try to achieve the same thing using a different API available on <a href="http://code.google.com/">Google code</a>. It&#8217;s called <a href="http://code.google.com/p/typica/">Typica</a> and is written by <a href="http://code.google.com/p/typica/people/list">dkavanagh and two other persons</a>.</p>
<p><code><br />
def registerInstance(Stirng instanceId, String loadBalancerName) {<br />
&nbsp;&nbsp;def loadBalancing = new LoadBalancing(accessKey, secretKey)<br />
&nbsp;&nbsp;loadBalancing.registerInstancesWithLoadBalancer(loadBalancerName, [instaceId])<br />
}</code></p>
<p>Now which one is easier to read?  Which one is faster to code? Which is more intuitive? Obviously the second one. I simply don&#8217;t understand the reason for long class names they have throughout the API and the request and result pattern. Every single method in Amazon&#8217;s sdk take a request object and return a result object. You are forced to create these extra long name objects! Thank god I did not write the code in java here, otherwise it wouldn&#8217;t have been even bigger as in Java you have to repeat a class name twice in a line if you want to create an object. The whole api is full of such examples.</p>
<p>I am not the only one screaming over the API. Steve Jin has expressed similar concerns about the API in his <a href="http://www.doublecloud.org/2010/04/amazon-aws-sdk-for-java-it%E2%80%99s-not-quite-there-yet/">DoubleCloud Blog</a>. According to Steve the API lacks consistency, clear object model and the structure of the API is flawed. </p>
<p>Hope enough people scream over the Internet so that Amazon can hear it.</p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/why-amazons-new-aws-java-sdk-sucks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Amazon AWS Java SDK released</title>
		<link>http://aws-musings.com/amazon-aws-java-sdk-released/</link>
		<comments>http://aws-musings.com/amazon-aws-java-sdk-released/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 01:25:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Autoscaling]]></category>
		<category><![CDATA[EBS]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[RDS]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[SNS]]></category>
		<category><![CDATA[SQS]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=252</guid>
		<description><![CDATA[Amazon recently announced  the AWS SDK for java. 
SDK or a java api is very much needed &#8211; especially if you are writing your automation scripts in groovy. We have tried multiple java apis in our scripts including JetS3t  and Typica. These apis were really helpful, but they only supported some of the [...]]]></description>
			<content:encoded><![CDATA[<p>Amazon recently <a href="http://aws.amazon.com/about-aws/whats-new/2010/03/22/announcing-the-aws-sdk-for-java/">announced</a>  the AWS SDK for java. </p>
<p>SDK or a java api is very much needed &#8211; especially if you are writing your automation scripts in groovy. We have tried multiple java apis in our scripts including <a href="http://jets3t.s3.amazonaws.com/index.html">JetS3t</a>  and <a href="http://code.google.com/p/typica/">Typica</a>. These apis were really helpful, but they only supported some of the AWS services and were not up to date (for obvious reasons). Having one java api that can support all of AWS technologies was definitely the need of the hour. I am sure Amazon will keep it updated as new services are released. They have the necessary resources to do so.</p>
<p>Furthermore, Amazon has also uploaded the SDK to the <a href="http://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk/1.0.002">maven repository</a>.<br />
You can use the following dependency in your pom.xml:<br />
<code><br />
&lt;dependency><br />
    &nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId>com.amazonaws&lt;/groupId><br />
    &nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId>aws-java-sdk&lt;/artifactId><br />
    &nbsp;&nbsp;&nbsp;&nbsp;&lt;version&gt;1.0.002&lt;/version><br />
&lt;/dependency><br />
</code><br />
The java doc for the SDK is hosted at <a href="http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/index.html">http://docs.amazonwebservices.com/AWSJavaSDK/latest/javadoc/index.html</a></p>
<p>Amazon has also opened the SDK source code for all. They have mirrored the SDK code repository at github. You can look at the SDK code at <a href="http://github.com/amazonwebservices/aws-sdk-for-java">http://github.com/amazonwebservices/aws-sdk-for-java</a></p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/amazon-aws-java-sdk-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Amazon Simple Notification Service &#8211; an easy messaging system in the cloud</title>
		<link>http://aws-musings.com/amazon-simple-notification-service-easy-messaing-system-in-cloud/</link>
		<comments>http://aws-musings.com/amazon-simple-notification-service-easy-messaing-system-in-cloud/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 22:34:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SNS]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=238</guid>
		<description><![CDATA[Amazon recently announced a new service called Simple Notification Service.
It provides a cheap publish/subscribe messaging system in the cloud. You can learn how to use it by visiting http://docs.amazonwebservices.com/sns/latest/gsg/
I played with it and found that the service is really easy to use, very robust and very extensible. It basically makes a publish/subscribe messaging service similar [...]]]></description>
			<content:encoded><![CDATA[<p>Amazon recently announced a new service called Simple Notification Service.<br />
It provides a cheap publish/subscribe messaging system in the cloud. You can learn how to use it by visiting <a href="http://docs.amazonwebservices.com/sns/latest/gsg/">http://docs.amazonwebservices.com/sns/latest/gsg/</a></p>
<p>I played with it and found that the service is really easy to use, very robust and very extensible. It basically makes a publish/subscribe messaging service similar to <a href="http://java.sun.com/products/jms/tutorial/1_3_1-fcs/doc/basics.html">JMS</a> available in the cloud. Having a cheap, robust publish/subscribe messaging system can serve many purposes in the cloud. In an auto scaled environment servers go up and down depending upon traffic. Here are some of the usages I can think of in our environment:</p>
<p><span id="more-238"></span><br />
<strong>Discover members of a cluster</strong><br />
We use JMX to switch on/off various services in our java webapp. <a href="http://www.jmanage.org/">JManage</a> allows us to configure a cluster and call a method remotely on the entire cluster. That is how we flush caches, switch on/off services etc. JManage is not sufficient by itself in an autoscaled environment as it does not detect new nodes automatically. When a new node comes up, somebody needs to configure the node in the JManage cluster. You can create a topic and publish a message to it with the external dns name of the newly born server in it. This message can be then consumed by a piece of code that can add the new node in the JManage Cluster. It&#8217;s also possible to similarly remove a node by publishing a message when the instance is terminated by auto scaling.</p>
<p>Discovering members of a cluster is very useful in a cloud environment especially in an auto scaled environment. As Http is supported as a protocol, it&#8217;s possible call a servlet (or similar concept in other platforms) url. This opens up a lot of possibilities. You can pretty much execute anything you want.</p>
<p><strong>Send email alerts without having to configure a SMTP server</strong><br />
Simply put, you can use SNS to send simple emails. All the email addresses need to be the subscribers of the topic, but that&#8217;s a trivial one time activity. No need to configure and maintain any SMTP server!</p>
<p><strong>Some nice to haves features</strong><br />
There is one particular thing I find annoying about SNS. Let&#8217;s say you subscribed to a topic using the email protocol. You will get a long string identifier called subscription arn. When you want to unsubscribe this email, you cannot supply the email address and the topic, you must supply the subscription arn. That&#8217;s not a good idea. It forces applications to store the subscription arn. To me an email and a topic combination is unique enough for them to determine the subscription. It will be much easier for applications if they change the unsubscribe api to accept the topic and the email address you want to unsubscribe. I can understand that they probably want their api to be protocol agnostic, but it will be a nice to have feature.</p>
<p>Furthermore, you cannot set the subject of the notification email. That means, if I am using multiple notifications in application, all the notifications will have the same standard subject line &#8211; <em>AWS Notification Message</em>.</p>
<p>It would also be nice to have twitter as a protocol. We use twitter heavily for notification. Twitter allows us to get notifications via text messages. <a href="http://pingdom.com/">Pingdom</a> got us into it.</p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/amazon-simple-notification-service-easy-messaing-system-in-cloud/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Web serving in the cloud &#8211; our experiences with nginx and instance sizes</title>
		<link>http://aws-musings.com/web-serving-in-the-cloud-our-experiences-with-nginx-and-instance-sizes/</link>
		<comments>http://aws-musings.com/web-serving-in-the-cloud-our-experiences-with-nginx-and-instance-sizes/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 01:05:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EC2]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=211</guid>
		<description><![CDATA[We have been doing various experiments in our ec2 web serving cluster to serve maximum traffic at the minimum costs. I thought our experience will be useful to many other people using ec2.
We have a web application with nginx + tomcat. We approximately get  200k requests per minute at the peak and about 65K [...]]]></description>
			<content:encoded><![CDATA[<p>We have been doing various experiments in our ec2 web serving cluster to serve maximum traffic at the minimum costs. I thought our experience will be useful to many other people using ec2.</p>
<p>We have a web application with nginx + tomcat. We approximately get  200k requests per minute at the peak and about 65K requests per minute at night. Since we host a webservice and not a webpage, most of our requests are servlet requests (and not the faster file serving, nginx based requests).</p>
<p><span id="more-211"></span><br />
We began our experiment with two m1.small machines. We set the autoscaling group minimum to two and set the tomcat file handle limit to be 65535.<br />
We based on autoscaling metric on latency. We asked our autoscaling group to increase the capacity if the latency goes beyond 0.75 seconds.</p>
<p>This didn&#8217;t work that well. Here is what happened:</p>
<p>1) We started getting cpu bursts in peak hours. CPU used to jump to 100%, there by causing latency to go beyond 0.75 seconds periodically. The autoscaling used to kick in, starting a new server. The latency use to fall back below 0.75 within few minutes and the autoscaling used to cut back the capacity to the minimum.</p>
<p>2) We also started getting nginx errors. Here is what the error said:<br />
<code><br />
(24: Too many open files) while accepting new connection on 0.0.0.0:80<br />
</code></p>
<p>Afer some research, we realized that the default nginx settings were not meant for the kind of scale we were dealing with. We changed the following settings in the /etc/nginx/nginx.conf:<br />
<code><br />
worker_processes 4;<br />
worker_rlimit_nofile 10240;<br />
events {<br />
  worker_connections 8192;<br />
}<br />
</code><br />
The nginx errors stopped. And the CPU bursts evened out for the non peak period. Here is how the graph looked right after we made the nginx change.</p>
<p><a href="http://aws-musings.com/wp-content/uploads/2010/03/Effects-of-nginx-settings-on-cpu.png"><img src="http://aws-musings.com/wp-content/uploads/2010/03/Effects-of-nginx-settings-on-cpu.png" alt="" title="Effects-of-nginx-settings-on-cpu" width="300" height="237" class="alignnone size-full wp-image-214" /></a></p>
<p>You can clearly see that the change the bursts stopped at one point (when we made the change). But the CPU bursts started coming back in the peak time. This time, nginx was fine and there were no errors in the log.</p>
<p>This was clearly a signal that m1.small was not performing well at that load (for our application). We decided to switch to c1.mediums.  We knew that <a href="http://aws.amazon.com/ec2/instance-types/">c1.mediums have 5 EC2 compute units where as the m1.smalls have 1 EC2 compute unit.</a> But we wanted to see how far m1.smalls can take us. The switch totally worked! Cpu bursts stopped. Autoscaling stopped kicking in. We can see the cpu going from 10% to 50% smoothly from non peak to peak hours. This is what we wanted!</p>
<p>Obviously two c1.mediums cost more than two m1.smalls. But we belive that we will be able to cope up with much larger growth using c1.mediums as the CPU is always hovering between 10 to 40%. In long term, it will definitely save us money. We will need less number of machines and we won&#8217;t waste money on instances getting started for a few minutes and getting shutdown when the bursts subside. </p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/web-serving-in-the-cloud-our-experiences-with-nginx-and-instance-sizes/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>7 easy tips to reduce your Amazon ec2 cloud costs</title>
		<link>http://aws-musings.com/7-easy-tips-to-reduce-your-amazon-ec2-cloud-costs/</link>
		<comments>http://aws-musings.com/7-easy-tips-to-reduce-your-amazon-ec2-cloud-costs/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 18:54:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Autoscaling]]></category>
		<category><![CDATA[EBS]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[RDS]]></category>
		<category><![CDATA[cloud cost]]></category>
		<category><![CDATA[cloud money saving]]></category>
		<category><![CDATA[it cost]]></category>
		<category><![CDATA[reduce ec2 costs]]></category>
		<category><![CDATA[save ec2 money]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=177</guid>
		<description><![CDATA[Amazon ec2 costs can grow very fast if you are not mindful of the Amazon ec2 billing structure. We came across the following ways to save money at our company. 
Keep machines in the same availability zone
Don&#8217;t scatter your machines that talk to each other across multiple availability zones. You will end up paying for [...]]]></description>
			<content:encoded><![CDATA[<p>Amazon ec2 costs can grow very fast if you are not mindful of the Amazon ec2 billing structure. We came across the following ways to save money at <a href="http://gumgum.com">our company</a>. </p>
<p><strong>Keep machines in the same availability zone</strong><br />
Don&#8217;t scatter your machines that talk to each other across multiple availability zones. You will end up paying for the bandwidth. Off course this does not apply to the people who purposely keep their machines in different availibilty zones to ensure high availibility.</p>
<p><strong>Use cnames instead of A records </strong><br />
In other words do not map your domain name to an elastic ip. Map it to the public domain name of the instance. Let&#8217;s say you have a machine with name splunk.gumgum.com. All the web servers (within the same availability zone) send considerable data to this machine. If you setup splunk.gumgum.com as an A record, your data will go out and come back in. But if you map it as cname, your data will always remain within the ec2 cluster. To read more about this visit <a href="http://alestic.com/2009/06/ec2-elastic-ip-internal">Eric Hammond&#8217;s Using Elastic IP to Identify Internal Instances on Amazon EC2</a> post.</p>
<p><span id="more-177"></span><br />
<strong>Use spot instances</strong><br />
Use spot instances whenever possible. Spot instances cost less than on demand instances. You can read more about<a href="http://aws.amazon.com/ec2/spot-instances/"> spot instances on Amazon&#8217;s web page</a>.  There is a website that shows <a href="http://www.spothistory.com/">spot history price graphs</a>. It  will tell you an average price of various types of instances. The average price of a m1.small sport instance is 3 cents an hour. You pay 8.5 cents an hour for the same type of on demand instance.</p>
<p><strong>Choose your instance types wisely</strong><br />
A smallest possible instance may not be the right choice to save money. For example c1.medium costs twice as much as m1.small. But it offers 5 times more compute power than m1.small. Thus in some compute heavy jobs it might be cheaper to use c1.medium instead of the least expensive m1.small.</p>
<p><strong>Choose the smallest possible storage</strong><br />
Choose the smallest possible EBS volumes and RDS instances. It is very easy to expand an ebs volume when needed. Same is the case with a RDS instance. Furthermore by choosing smaller drives, you will save money needed for the backup(snapshot) storage too.</p>
<p><strong>Use Autoscaling</strong><br />
<a href="http://aws.amazon.com/autoscaling/">Autoscaling</a>  can start additional instances when needed. It can shut down the additional instances when the need disappears. This is especailly useful for hosting websites/web services that have a specific traffic/usage pattern.</p>
<p><strong>Reserve your instances</strong><br />
You can reduce your costs significantly by reserving number of instances for a year or for three years. Reservation is only a billing concept and thus you don&#8217;t have to designate any istances as reserved. If you reserve 4 m1.small instances, Amazon will make 4 of your running m1.small instances as reserved. For more information <a href="http://www.allthingsdistributed.com/2009/03/amazon_ec2_reserved_instances.html">visit Werner Vogels&#8217;s (Amazon CTO) blog</a>.  </p>
<p>There might be numerous other ways you can save money. Please feel free to leave a comment to share your ways. The more the merrier!</p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/7-easy-tips-to-reduce-your-amazon-ec2-cloud-costs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Amazon Relational Database Service (RDS) &#8211; The Timezone Problem</title>
		<link>http://aws-musings.com/amazon-relational-database-service-rds-the-timezone-problem/</link>
		<comments>http://aws-musings.com/amazon-relational-database-service-rds-the-timezone-problem/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 05:41:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EC2]]></category>
		<category><![CDATA[RDS]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql in cloud]]></category>
		<category><![CDATA[time zone]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=155</guid>
		<description><![CDATA[The default time zone of your RDS database instance is UTC. It simply can not be changed. 
RDS does not give you super privileges. That is why you won&#8217;t be able to change the global time zone by simply executing:

SET GLOBAL time_zone = 'US/Pacific';


The default_time_zone db parameter is not modifiable.
In this Amazon forum thread, you [...]]]></description>
			<content:encoded><![CDATA[<p>The default time zone of your <a href="http://aws.amazon.com/rds/">RDS</a> database instance is UTC. It simply can not be changed. </p>
<p>RDS does not give you super privileges. That is why you won&#8217;t be able to change the global time zone by simply executing:<br />
<code><br />
SET GLOBAL time_zone = 'US/Pacific';<br />
</code><br />
<span id="more-155"></span><br />
The default_time_zone db parameter is not modifiable.</p>
<p>In <a href="http://developer.amazonwebservices.com/connect/thread.jspa?messageID=161339">this Amazon forum thread</a>, you can clearly see the AWS guy saying that there is no way to change the time zone of a RDS instance.</p>
<p>It is very important to understand that unlike Java (or other programming languages), MySQL does not store time zone in its date, datetime or timestamp datatypes. That is why it&#8217;s important that all the dates are stored in one time zone. Most people prefer to store them in their own time zone for easier calculations.</p>
<p>Since you cannot change the database server settings, you will have to change your application. Here are some approaches you can take to make sure that the date and time stored in your database is in your desired time zone.</p>
<p><strong>1) Set time zone per database connection </strong><br />
When ever you create a connection, set time zone using<br />
<code><br />
SET time_zone = 'US/Pacific';<br />
</code><br />
This time zone will be valid only for the connection. That is why it must be done for every single connection you open. If you have a java application, you can use a wrapper around the JDBC driver to accomplish this.</p>
<p>Please note that MySQL allows you to specify time zone by its name (such as &#8216;US/Pacific&#8217;) or by the difference in hours  (such as &#8216;-8:00&#8242;). If you are in a part of United States or any other part of the world that uses day light savings, do not use the difference of hours option for obvious reasons.</p>
<p>Named time zones can only be used if the time zone related tables are populated in MySQL. Thankfully they seem to be populated in RDS.</p>
<p><strong>2) Use convert_tz function</strong><br />
You can use MySQL&#8217;s convert_tz function to convert the time zone. For example:</p>
<p><code><br />
insert into my_table (created_date) values (convert_tz(now(), 'GMT', 'US/Pacific'));<br />
</code></p>
<p>For more information on convert_tz function visit  <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_convert-tz">convert_tz documentation on MySQL website</a> </p>
<p><strong>3) Set the date/time pragmatically in your application code in every query. </strong><br />
Thus if you have created_date column in your table, do not rely on timestamp datatype&#8217;s default value. The default value will be in  UTC time zone. Set the value explicitly using application code. If you are using a prepared statement this becomes very easy. All you have to make sure is to pass a date object with appropriate time zone set in it. In order for your application to calculate correct date, you have to make sure that your application instance&#8217;s time zone is set to your time zone.</p>
<p>Amazon ec2 instances allow you to change their default time zones. If your web server is also deployed in ec2, I would suggest you to bundle an AMI with your time zone and use it to launch all your instances. I think most of the ubuntu public AMIs have time zone set to UTC.</p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/amazon-relational-database-service-rds-the-timezone-problem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>4 easy steps to enable remote desktop on your ubuntu ec2 instance</title>
		<link>http://aws-musings.com/4-easy-steps-to-enable-remote-desktop-on-your-ubuntu-ec2-instance/</link>
		<comments>http://aws-musings.com/4-easy-steps-to-enable-remote-desktop-on-your-ubuntu-ec2-instance/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 23:18:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EC2]]></category>
		<category><![CDATA[freenx]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[nx]]></category>
		<category><![CDATA[remote desktop]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vnc]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=124</guid>
		<description><![CDATA[Enabling remote desktop on an ubuntu ec2 instance is pretty easy by using NX.  We will use FreeNX at the server and NoMachine NX client on the client machine. NX is a much better alternative to VNC. You can install NoMachine client on windows, mac or linux. For more information visit http://www.nomachine.com

Here are the [...]]]></description>
			<content:encoded><![CDATA[<p>Enabling remote desktop on an ubuntu ec2 instance is pretty easy by using NX.  We will use FreeNX at the server and NoMachine NX client on the client machine. NX is a much <a href="http://www.keycruncher.com/blog/2008/07/07/vnc-vs-nomachine-nx-nomachine-wins-hands-down/">better alternative to VNC</a>. You can install NoMachine client on windows, mac or linux. For more information visit <a href="http://www.nomachine.com">http://www.nomachine.com</a></p>
<p><span id="more-124"></span><br />
Here are the easy steps:</p>
<p><strong>1) Install ubuntu desktop on your server instance</strong><br />
By default X server, GNOME etc is not installed on your ubuntu instance. You can install it by simply executing the following commands:<br />
<code><br />
export DEBIAN_FRONTEND=noninteractive<br />
sudo -E apt-get update<br />
sudo -E apt-get install -y ubuntu-desktop<br />
</code><br />
It will install lot of stuff. So don&#8217;t get surprised if it takes 10 to 15 minutes to finish it.</p>
<p><strong>2) Install FreeNX server on your server</strong><br />
The following commands assume that you are using ubuntu 9.10 (Karmic Koala) image.<br />
<code><br />
sudo add-apt-repository ppa:freenx-team<br />
sudo apt-get update<br />
sudo aptitude install -y freenx<br />
sudo /usr/lib/nx/nxsetup --install<br />
</code></p>
<p><em>If you are using older ubuntu versions, please visit <a href="https://help.ubuntu.com/community/FreeNX">FreeNX server installation page on ubuntu website</a> to get the instructions for installing FreeNX  server.</em></p>
<p>While executing the last command, you will get the following prompt:</p>
<p><code>It is recommended that you use the NoMachine key for<br />
        easier setup. If you answer "y", FreeNX creates a custom<br />
        KeyPair and expects you to setup your clients manually.<br />
        "N" is default and uses the NoMachine key for installation</code>.</p>
<p>I would say answer &#8216;N&#8217; which is the default. If you answer Y, you will have to generate keys and put them at a specific location in the client.</p>
<p><strong>3) Enable password authentication on the ssh server</strong><br />
Edit  /etc/ssh/sshd_config and set PasswordAuthentication to yes. By default password authentication is disabled.<br />
You will need to restart ssh process by executing</p>
<p><code>sudo /etc/init.d/ssh restart</code></p>
<p>Now that you have enabled password authentication, you should make sure that the the user you are going to use for using remote desktop has a password. Cannonical&#8217;s karmic images come with &#8216;ubuntu&#8217; user. This user does not have a password. You can set a password by executing</p>
<p><code>sudo passwd ubuntu</code></p>
<p><strong>4) Install and setup NX client </strong><br />
Now install the NoMachineNX client on your Desktop. You can download the client form <a href="http://www.nomachine.com/download.php">http://www.nomachine.com/download.php</a>. You can install it by simply double clicking the downloaded file. Once you install it, click on the NX Connection wizard to setup a new connection. Fill in the values as shown below. Make sure that you put in your server address in the host field.</p>
<p><a href="http://aws-musings.com/wp-content/uploads/2010/02/NX-1.jpg"><img src="http://aws-musings.com/wp-content/uploads/2010/02/NX-1-300x213.jpg" alt="" title="NX-1" width="300" height="213" class="alignnone size-medium wp-image-144" /></a></p>
<p><a href="http://aws-musings.com/wp-content/uploads/2010/02/NX-2.jpg"><img src="http://aws-musings.com/wp-content/uploads/2010/02/NX-2-300x213.jpg" alt="" title="NX-2" width="300" height="213" class="alignnone size-medium wp-image-145" /></a></p>
<p>And that&#8217;s it! NX client will create a desktop shortcut for the server connection (Only if you choose to do so). Double click the shortcut, fill in the username (ubuntu) and the password (set in step 3) and you are in!</p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/4-easy-steps-to-enable-remote-desktop-on-your-ubuntu-ec2-instance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Database in cloud &#8211; Amazon RDS or MySQL on ebs?</title>
		<link>http://aws-musings.com/database-in-cloud-should-i-use-amazon-rds-or-mysql-installed-on-an-ebs-backed-ec2-instance/</link>
		<comments>http://aws-musings.com/database-in-cloud-should-i-use-amazon-rds-or-mysql-installed-on-an-ebs-backed-ec2-instance/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 17:56:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[RDS]]></category>
		<category><![CDATA[cloud database]]></category>
		<category><![CDATA[ec2 database]]></category>
		<category><![CDATA[mysql in cloud]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=114</guid>
		<description><![CDATA[Recently Amazon launched RDS &#8211; Relational Database Service. Before Amazon offered this service, we had a MySQL configured on an ec2 instance. We needed one more database in cloud. Which way did we go? In this article, I have tried to compare both the options. 

RDS Pros:
1) No need to maintain MySQL in the cloud. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently Amazon launched <a href="http://aws.amazon.com/rds/">RDS &#8211; Relational Database Service</a>. Before Amazon offered this service, we had a MySQL configured on an ec2 instance. We needed one more database in cloud. Which way did we go? In this article, I have tried to compare both the options. </p>
<p><span id="more-114"></span><br />
<strong>RDS Pros:</strong><br />
1) No need to maintain MySQL in the cloud. Amazon will maintain it. Amazon will apply all the patches and upgrade the server software.</p>
<p>2) It&#8217;s very easy to scale up. All you have to do is execute <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2936">rds-modify-db-instance command</a>. You can change your db class to the bigger/better machine.</p>
<p>3) Snapshot based backups are very easy to manage.</p>
<p>4) No need to manage an ec2 volume, backup and an ec2 instance separately to run your database in the cloud. RDS combines all the three in one package.</p>
<p><strong>RDS Cons:</strong><br />
1) The biggest problem about RDS is the 4 hour per week maintenance window. I don&#8217;t believe that this maintenance takes place every week. They only take down your database when they are applying patches or upgrading the database server. They will take down your database in your specified time only. This time can be changed any time by simply executing an api call. I also believe that in most cases the downtime  will be much less than 4 hours. Nevertheless the threat of downtime exists every week!</p>
<p>2) Does not expose my.cnf file of the database. It instead gives you an <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2935">API to modify the parameters</a></p>
<p>3) If you are an advanced MySQL user and want to use tweaked MySQL (such as by Percona http://www.percona.com/), RDS is clearly not a solution.</p>
<p>4) As of now, there is no replication support. This means you cannot have any read only slaves. I have read somewhere that they are working on it. </p>
<p>Clearly RDS is not a silver bullet. In fact in many cases where your application cannot run without a database, you may not be able to afford the weekly downtime. I talked to some friends and the 4 hour weekly downtime was their the biggest problem with RDS.  I wish that Amazon would declare the downtime whenever the need arises (such as when new MySQL patches are ready) and less frequently (such as once a month).</p>
<p>We did not have a full time system administrator in our team. We were bunch of software engineers trying to manage our ec2 instances by ourselves. Furthermore our application wasn&#8217;t dependant on database completely. Most of the data was cached. Thus we could afford an occasional downtime. That is why we chose RDS.</p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/database-in-cloud-should-i-use-amazon-rds-or-mysql-installed-on-an-ebs-backed-ec2-instance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to expand your ebs volume</title>
		<link>http://aws-musings.com/how-to-expand-your-ebs-volume/</link>
		<comments>http://aws-musings.com/how-to-expand-your-ebs-volume/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 18:56:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[EBS]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[ebs volume]]></category>
		<category><![CDATA[expand ebs volume]]></category>
		<category><![CDATA[grow ebs]]></category>

		<guid isPermaLink="false">http://aws-musings.com/?p=104</guid>
		<description><![CDATA[Increasing size of your ebs volume is pretty easy. resize2fs does the trick. Here is the detailed procedure to increase size of your ebs volume.
First detach the volume and take a snapshot of the volume. If you already have a snapshot and haven&#8217;t made any changes after that, no need to take a new snapshot.

No [...]]]></description>
			<content:encoded><![CDATA[<p>Increasing size of your ebs volume is pretty easy. resize2fs does the trick. Here is the detailed procedure to increase size of your ebs volume.</p>
<p>First <a href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?detaching-ebs.html">detach the volume</a> and take a snapshot of the volume. If you already have a snapshot and haven&#8217;t made any changes after that, no need to take a new snapshot.</p>
<p><span id="more-104"></span><br />
No create a new volume from this snapshot. Let&#8217;s say your original volume was 10G and you wanted to increase its size to 20G.<br />
<code><br />
ec2-create-volume -z us-east-1a --size 20 --snapshot snap-xxxxxxxx<br />
</code><br />
The command will output id of the new volume. Use that id in the following command to attach the volume to any instance you have up.<br />
<code><br />
ec2-attach-volume vol-yyyyyyyy --instance i-xxxxxxxx --device /dev/sdh<br />
</code><br />
Make sure that ec2-describe-volumes show the state of the instance as attached. Once the volume is attached, mount it at a path say /mnt/data. I am assuming here that your volume had ext3 filesystem.<br />
<code><br />
mkdir /mnt/data<br />
echo '/dev/sdh /mnt/data ext3 defaults,noatime 0 0' >> /etc/fstab<br />
mount /mnt/data<br />
</code><br />
Mounting the volume is necessary as otherwise you wont&#8217; be able to execute the following (resize2fs) command.<br />
Now execute the following command to resize the volume<br />
<code><br />
resize2fs /dev/sdh<br />
</code><br />
You should see the following output (sizes you see might be different):<br />
<code><br />
Filesystem at /dev/sdh is mounted on /mnt/data; on-line resizing required<br />
old desc_blocks = 1, new_desc_blocks = 2<br />
Performing an on-line resize of /dev/sdh to 5505024 (4k) blocks.<br />
The filesystem on /dev/sdh is now 5505024 blocks long.<br />
</code><br />
The command should execute in a minute or two for 20G size. That&#8217;s it, you can verify your new size by executing:<br />
<code><br />
df -h<br />
</code><br />
This should show you that the volume&#8217;s new size. That&#8217;s it! </p>
]]></content:encoded>
			<wfw:commentRss>http://aws-musings.com/how-to-expand-your-ebs-volume/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
