How to enable ephemeral storage on Amazon Beanstalk instance.

Amazon’s Beanstalk is a great deployment environment for startup like us. Occasionally, we see issue on the beanstalk but lucky beanstalk allow us to use custom AMI for the beanstalk instances.

One of the issue we seen is that beanstalk only comes with 8GB ESB storage. But in fact, each EC2 instance comes with ephemeral(local) storages.(the size varies based on the instance type).

Our goal is to enable these missing ephemeral storage for the tomcat application. To do create a custom AMI with ephemeral storage.

I. Disable Auto Mount

Due to the default setting in CloudInit, it always mounts the first ephemeral drive on /media/ephemeral. To make the mountpoint customizable, we have to disable automount ephemeral0 first.

To do so, you have to launch a new instance with the beanstalk AMI first.

ec2-run-instances ami-b8c539d1 -t m1.large

Log in to the server
Edit /etc/sysconfig/cloudinit, and set CONFIG_MOUNTS=no.
Edit the /etc/fstab

/dev/sdb /var/cache/tomcat6 auto defaults 0 2
  /dev/sdc /tmp auto defaults 0 2

And then delete everything in /var/cache/tomcat6.

rm -rf /var/cache/tomcat6/*

II. Create a Temporary AMI

Log in to and create a new AMI based on the instance we just used.

III. Create the Cloud Init Script

Open your text editor and create a tomcat.init script on your local machine


chown root:root /var/cache/tomcat6
chmod 755 /var/cache/tomcat6
chmod 1777 /tmp

if [ ! -d  /var/cache/tomcat6/temp ]
  mkdir /var/cache/tomcat6/temp
  chmod 775 /var/cache/tomcat6/temp
  chown tomcat:root /var/cache/tomcat6/temp
if [ ! -d  /var/cache/tomcat6/work ]
  mkdir /var/cache/tomcat6/work
  chmod 775 /var/cache/tomcat6/work
  chown tomcat:root /var/cache/tomcat6/work

IV. Create a New Instance with Ephemeral Storage

ec2-run-instances ami-xxxxxxx --user-data-file tomcat.init -b /dev/sdb=ephemeral0 -b /dev/sdc=ephemeral1 -t m1.large 

V. Create Beanstalk AMI

Log in to and create a new AMI based on the instance we just initiated. This AMI is the AMI you can use in your beanstalk environment.

Why don’t work well in Taiwan

This is part of my posting on telnet://



直的是 Ave(大道),橫的是St(街),門牌號碼的排法是每一個路口就是重新算 100號做起始。所以算 3712 號,就是在該路第三十七跟三十八個路口間,用內差法來做排列。若是一個大樓占據了整個區間,下一個路口仍是從 xx00 開始排

至於台灣的排法,則是從路口來數大樓數,要是碰上一個大樓佔了整個區塊,下一個建物還是的門牌還是 N+1
所以就碰上了從市貿到NY Bagles 這邊,整排都是大型大樓,就只有幾個門牌號碼。在這一區,Google就吃鱉吃的很慘,我有次要去鴻喜花園的店,Google.Map給我的地址跑到三百公尺外的牡丹園去。


ps: 台灣門牌,原地改建時會變得更好玩,一棟變三棟就變 -1 -2 -3 ,我上禮拜有碰過 -47 的 Orz..

Monthly Review: March 2011.

It was quit busy three months for me and thing has changed a lot during the last three month.

First, we had a new hire, a full-time SDET, Ace Chen. He will be responsible for load testing and performance estimating on our platform product.

On the frontend side, Even and Michael are working hard to bring the frontend UI to market. We are approaching the final stage of design and implementation. You could expect to see the beta release in the coming two months.

A pricing and billing system is under-way too, we have surveyed few billing platform including Paypal WebPro, Recurly, Braintree, etc… and chose Chargify as our solution.

On the platform side, a lot of thing has changed. First, we switched our choice of cloud provider from Rackspace to Amazon beanstalk. The decision is based on our experience with operational support and reliability of Rackspace.

Also, the platform has written to adopt to the benefit of the Amazon offering. The cassandra cluster has been replaced by S3 and SimpleDb. Asynchronized event processing is brought to our platform with the help from Akka, Camel, and Amazon SQS.

During the load test, we already got some good numbers from the platform. We will start to build demo client applications soon.

Monthly Review: December 2010.

December is a quite interesting month for bluetangstudio.

We have hired our 1st (part-time) employer as a SDET. Also, we may have a new hire who will join bluetangstudio early next year.

Also, we have finalized the software architecture design and the customer facing API for our platform produce. At the mean time, we also finalized the web design. This is quit going well this year.

Being an entrepreneur is always an exciting thing on both good and bad side of life. One just can not expect what will happen in the next second. No matter what kind of difficulty is standing in front of you, you have to laugh at it and solve the situation.

Early this month, we lost one web designer contractor before of his tight schedule. In just few days, I met another excellent web designer, Even Wu. Even has designed few major websites in Taiwan, I can’t wait to see what kind of product we will create together.

Blue Tang Studio is Hiring…

Blue Tang Studio is a newly founded startup focusing on location base service. We are building a search platform for mobile applications and web-applications. Currently, We are looking for experienced developers to create our framework product.

Required Qualifications:
* At least 4 years experience in Java and web development.
* Familiarity with JavaScript, jQuery and/or prototype.
* Experience with agile development methodologies.
* Good understanding of RESTful web-service, JSON, XML, JAXB,and JAX-RS.
* Prior experience with dependency injection frameworks, such as Spring or Guice.
* Proficient with Linux/Unix and open source tools/platforms
* Proficient in English

* Experience with search, using Lucene and/or SOLR.
* Experience with Tapestry 5.
* Familiarity with dynamic languages such as Ruby, Python, and Scala.
* Familiarity with web application architecture and deployment.
* Experience with Google App Engine or Amazon EC2 is beneficial.

Programming Challenge:
Without using any built in date or time functions, write a function or method that accepts two mandatory arguments. The first argument is a string of the format “[H]H:MM {AM|PM}” and the second argument is an integer. Assume the integer is the number of minutes to add to the string. The return value of the function should be a string of the same format as the first argument. For example AddMinutes(“9:13 AM”, 10) would return “9:23 AM”.

Work Condition:
* Office location: 臺北市大安區敦化南路1段245號11樓(敦南誠品樓上)
* Flexible work hour: You have to attend to 11am daily meeting and provide 8 hours of service.
* Labor and Health insurance.

Please send you resume, the source code, and your desired pay rate to to apply for this position.

About Us

原點科技(Blue Tang Studio) is a newly founded start-up focusing on location based service. We are building a search platform for mobile applications and web-applications.

The platform is our strategic product and will enable the internal and external customers to build new location based service within few weeks.

The are looking for talented and self-motivated people to join our team.

原點科技為一新創公司,公司的主力方向是在Location Based Service,目前正在開發搜尋平台中。


敝公司的目標正在於,建立一個雲端資料庫,提供SDK及Cloud Solution給各國的軟體公司,希望有志於軟體產品開發的人材加入。


在第一篇介紹完第一銀行的幾張現金回饋卡後,接著我要介紹美國運通卡;AMEX發行的卡片,曾是筆者在美國時期的最愛,AMEX的目標客戶群是人口結構中收入較高的一群,提供的服務自然不在話下,如30天只要USD 29塊的租車保險,購物自動延長一倍保固(買電器最好用,買Apple MacBook,刷AMEX的卡,一年保固變兩年保固),與COSTCO發的聯名卡在餐廳刷有3%的現金回饋,是外食族的最愛,刷機票旅館也有2%;為了與現金回饋的卡競爭,所以也推出有1.5%的Blue Cash。






點數除了可以抵年費外,還可以用來直接抵刷卡金額,規則是每1,000點可以抵新台幣100元,換算起來是100 / 1000 / 30 = 0.33%。





function update() {
s1 = parseInt($(‘#general’).attr(‘value’));
s2 = parseInt($(‘#grocery’).attr(‘value’));
s3 = parseInt($(‘#dpstore’).attr(‘value’));

total = s1 + s2 + s3;

cb1 = total * 0.005;
cb2 = total * 0.001;
if (total > 10000) {
   cb2 = 10;
   cb2 += (total-10000) * 0.007;

cb3 = s1 * 0.002;
sp = s2 + s3;
if (sp < 20000) {
  cb3 += sp * 0.002;
else {
  sp -= 20000;
  cb3 += 20000 * 0.002;

  if (sp < 30000) {
    cb3 += sp * 0.005;
    sp -= 30000;
    cb3 += 30000 * 0.005;
    cb3 += sp * 0.008;





  1. 不限商店別,一率2%現金回饋的現金回饋卡
  2. 在超市及加油站專用,5%現金回饋的卡
  3. 一張高額度的1.5%現金回饋卡,當做備用卡。

由於我是信用卡狂人,什麼消費能刷卡,絕不付現,因此,一年大約刷卡消費五十萬元,然後另外還有二十萬是花在超市及加油上;算起來,一年我都收到約兩萬元的現金回饋(500,000 * 2% + 200,000 * 5%)


卡名 第一銀行穩賺金融卡
年費 未知
循還利率 未知
現金紅利 每筆簽帳回饋0.5%
卡名 第一銀行媚儷鈦金卡【簽萬名媛】
年費 首年正卡年費1,200元,附卡年費600元(核卡即收無減免),第二年起,正(附)卡合計每滿1萬元,可扣抵年費100元,至年費扣底完為止。
循還利率 未知
現金紅利 當月累積簽帳達1萬,現金回饋0.7%;1萬以下回饋0.1%,刷的越多,回饋越高。
卡名 第一銀行I First生活卡
年費 未知
循還利率 未知
現金紅利 一般消費:現金回饋0.2%


穩賺金融卡 現金回饋:100
媚儷鈦金卡 現金回饋:80
I First生活卡 現金回饋:40

乍看之下,好像穩賺金融卡的福利最遭,可是細算之下好像又不是這樣。用上面的試算表,算一下,若是消費金額少、且不在超市及百貨消費的話,給與5%現金回饋的穩賺金融卡,比另外兩者可能幫你賺的更多的錢。至於I First生活卡,只有在百貨每月消費超過七萬元時,回饋才會比穩賺金融卡多。