Configure https for a web app hosted on AWS beanstalk

AWS elastic beanstalk is a popular way to host a web app (See description below from Beanstalk Introduction). AWS beanstalk documentation gives a brief introduction on steps on configuring https for a web app, it leaves some details for readers to figure out. In this post, we write down steps we went though, and focuses on two missing pieces from the doc: get a custom domain name (from Amazon Route 53); and get a X509 Certificate (from Let’s Encrypt).

With Elastic Beanstalk, you can quickly deploy and manage applications in the AWS cloud without worrying about the infrastructure that runs those applications. AWS Elastic Beanstalk reduces management complexity without restricting choice or control. You simply upload your application, and Elastic Beanstalk automatically handles the details of capacity provisioning, load balancing, scaling, and application health monitoring.

Get a custom domain name from AWS Route 53

When we upload a web app to AWS elastic beanstalk, we get a url to access the web app in the format of xxx.elasticbeanstalk.com. When the web app is ready for production, we need apply for  a custom domain name (such as example.com) for it. Among many ways to register a custom domain name, we choose AWS route 53 purely because it is part of AWS like our other services.

  • Log on AWS console
  • Go to Services, Networking, Route 53, and follow instructions to apply for a domain name.
  • After Route 53 approves the application, it will automatically create a hosted zone that contains SOA and NS records for the domain.
  • In order to resolve the domain name to the beanstalk web app, Click on the hosted zone, click on “Add Resource Record Set“, and add an entry to map the domain name to ip address of the beanstalk load balancer. Following graph shows an example. Choose “Alias” and put into “Alias Target” the load balancer url (AWS automatically put all load balancer URLs as a drop down for “Alias Target”).

Screen Shot 2016-01-08 at 8.44.50 PM

  • We can now access the web app via the custom domain name (such as example.com)

After setting up a custom domain name for the beanstalk web app, we need configure https for it.

Get a X509 Certificate from “Lets Encrypt”

To configure https for a web app, we need first get a X509 Certificate from a Certificate Authority. We choose lets encrypt  because it is free, and more importantly it automates the process of getting / renewing a certificate via simple commands. (see quote from lets encrypt)

Anyone who has gone through the trouble of setting up a secure website knows what a hassle getting and maintaining a certificate can be. Let’s Encrypt automates away the pain and lets site operators turn on and manage HTTPS with simple commands.

No validation emails, no complicated configuration editing, no expired certificates breaking your website. And of course, because Let’s Encrypt provides certificates for free, no need to arrange payment.

However, “lets encrypt” is an ongoing project, and has not fully automated the process of getting a certificate for beanstalk web app yet (as 01/2016). How it works page on “lets encrypt” assumes a user can run commands on the machine where web service runs, while beanstalk web app runs on AWS hosts where we do not have access. Also, “lets encrypt” needs access port 443 (https) of the web app’s host machine (see A blog by Eran Sandler). Here are steps we used to get around the problem.

  • Configure https for beanstalk web app using a self-signed certificate. AWS elastic beanstalk document gives details about steps to generate a self-signed Certificate, and configure https for your web app with a self-signed certificate. By doing so, we open up the port 443 for the host.
  • Follow How it works to install “lets encrypt”, and run it in manual mode like following. You will need replace example.com with your domain name.

./letsencrypt-auto certonly –manual –debug -d example.com -d http://www.example.com

  • The command will pause and prompt user to create a page in the web app with a specified content. “lets encrypt” uses this way to verify that the user has the full control of the domain name and web app. We create the page as instructed, redeploy the web app on beanstalk, and resume the process.  A certificate is created on the local machine.
  • Upload the certificate  to beanstalk and configure https as instructed (Beanstalk Doc). Boom !

Handle Swipe Gestures in iOS

Following three articles provide from easy to more comprehensive tutorials on how to handle swipe gestures in iOS.

Detecting swipe gesture in iOS8 with Swift: Address the simple case of detecting swipes in iOS

Handle Swipe Gestures on UITableview:  A simple example on how to associate a swipe action with a particular table row

Make Swipeable Table View Cell with Actions: A comprehensive tutorial on customizing the swipe actions on UITableView Cell.

How to raise Money

Notes from the Stanford startup class given by (Eric Andreessen, Ron Conway, Park Conrad). Original class video is at http://startupclass.samaltman.com/courses/lec09/

What factors do investors look into when deciding to invest ?
founders / ideas / products / customers. Founders need be

  1. a (born) leader who can grow a team, and make tough decision down the road.
  2. passionate and obsessed by the product that is based on her/his personal experience
  3. a good communicator

Investors invest in team first, and tend to invest teams they have worked with in the past. Especially for enterprise facing products, founders must have a track record of related expertises in the given area.
Successful company usually have several equally good co-founders. Therefore, looking for someone who is as good or better than you when starting a company.

How does venture capital work ?
VC makes most of their profit from a few very successful companies. Therefore, they are looking for extreme outliers. They tend to focus on companies with really extreme strength, and can tolerate flaws. An example of VC Funnel of startups: 4000 (total) –> 400 (seed) –> 15 (more rounds) –> 2 (success) each year.

How can founders give investor a good impression and get funded ?
Get funded is the easiest part when building the company. Therefore, before getting funded, focus on building the business. If the business that is growing, you can easily get fund. So bootstrap as long as you can. To get funded,

  1. describe company mission in one sentence
  2. be decisive (can make tough decisions)
  3. can build a great team (execution)

How many shares do founders need give up in each round ? And how much investors usually invest in each round ?

There is no definitely rule for it. The key is to make sure that founders and the team still have enough incentives. Usually, founders sells 10 – 15% in seed round, and sells 20 – 30% in A round.

seed round is about 1-2 million $. Investors get leads through their referral network, vote whether to call based on a short summary of the project; a good phone call leads to an interview; then decide whether to invest.

VC mostly work with startups that completed a seed round. VC gets leads via introduction (seed investors usually can help with that).

Founders should take notes for meetings with investors who usually have a short memory. Put agreement in writing, and follow up with emails.

How do founders decide the amount of money they need raise in each round ?
Founders need have a very precise plan on what they want to achieve at the end of each round, then figure out the amount of money based on the plan.

Why do founders need investment ? What other helps can a founder get from investors ?
A good Investor has good domain expertise, and can help much more than just providing the money. Besides, they can help introduce less established founders to other investors in future finance round.

How do founders pick the right investors ?
Finding the right investors is very important because you will work together for many years going forward. It is like a marriage. A good investor should

  • have domain expertise in the area.
  • can do intro to other investors / teams / related parties
  • someone you respect and can learn a lot from.

How does investors handle the conflict of interests ?
Investors usually only invest one company in each category.

Legal and Accounting Basic for Startups

Notes from the Stanford startup class given by (Kirsty Nathoo, Carolynn Levy). Original class video is at http://startupclass.samaltman.com/courses/lec18/

Key takeaways: keep it simple, and use standard document, and stay organized etc.

How to create the company ?
keep it simple, and follow what most of startups do: create a Delaware C Corp. YC companies use clerky.com.

How to handle equity ?
In YC companies, founders usually split shares equally among them because two reasons: Execution bigger than Ideas;  focus on future instead of what has been done.
Most of SV companies use the standard 4 year vesting schedule with a one-year cliff. Make sure all documents get signed (stock purchase program, and 83-b, etc.). If someone leaves, the company repurchases unvested shares.

Fund raising Issues ?
seed round has no price, and series A and B has a price. Raising money dilutes founders’ shares. Therefore, be selective when raising money, and get investment from people who is sophisticated and know what they are doing. Investors may have following requests:

  • board seat. some investors ask for a seat in the company. In most cases, say NO unless the person can add values into the direction and strategies.
  • advisors. Investors may ask for more shares for being advisors. say NO because they  should already do so.
  • Pro rata right. This is the right to maintain the ownership percentage of a company via buying more shares in the future. This is a common request. If granted, as a result, the founders will get a bigger dilution in the future.
  • Information right. Founders should give monthly updates to investors, and ask for helps on hiring, and introductions

Do not spend company money on stupid causes, and keep track of expense receipts.

How to run business in early stage ?
Use a payroll providers (such as zenpayroll.comzenefits.com).

Founders are employee too, therefore, the company should / need pay them (along with payroll tax). It helps avoid potential legal issues. You could pay founders minimum wages (2000$ per month at San francisco).

Hiring Employees or contractor is different. Make sure you know the difference in term of paper works and tax: contractor can set their own working hours and locations, and use a consulting agreement. The company files 1099 form to individual and IRS at the end of the year. employee signs a IP agreement, and the company withholds tax and report tax to IRS. Check proof of work authorization.

Fire employees quickly; do not apologize and be straightforward, and talk in person with a third-party present; pay wage right away; eliminate access and repurchase unvested stocks.

How to Talk to Investors

Notes from the Stanford startup class given by (Michael Seibel, Qasar Younis, Dalton Caldwell). Original class video is at http://startupclass.samaltman.com/courses/lec19/

How to create VC pitch ?
talk less could be better. Should prepare a 30 second pitch and 2 minute one.
30 second pitch

  • what does your company do ?
  • how big is your market ?
  • How much traction do you have

2 minutes pitch (besides everything in 30 second pitch)

  • unique insight (competing advantage / aha moments in two sentences)
  • How will you make money ? (advertising / direct sales / etc.) be clear and be concise.
  • Team.  If your team has done something significant, say it. Otherwise, try to be clear on: the number of founders, percentage of tech founders, how long have you known each other ? are you work on it full time.
  • Big ask. how much money you plan to raise ? What type safe / convertible notes.

When to raise Money ?

  • raise money when your product is getting traction
  • when you are strong, and investors are weak.
  • create a plan to grow without raising money
  • always be able to present your team as fast executing and fully committed.

How to set up a investor meetings ?

  • warm intros (find someone who have done it before)
  • think parallel  (schedule meetings with all investors in one week), aim for a time three weeks away
  • Have a team member working full time on investing and fund raising

During the meeting

  • make sure the listener understands what you are working on
  • know your numbers (user traction etc.)
  • quantify market size via a bottom-up analysis
  • present insights that is counterintuitive (competitive advantage)
  • show your team is uniquely suited for this business.
  • Drive the conversation to the end.

good points

  • capture interest by telling a good story about your product (such as a customers’ experience)
  • demonstrate insights
  • more a collaborative meeting than an interview.
  • ask for money

After the meeting

  • Follow up.
  • work on creating deal heat (supply / demand)
  • do diligence on investors
  • know when to stop (do not addict to fundraising)
  • Most importantly, focus on building the company

How to be a great founder

Notes from the Stanford startup class given by (Reid Hoffman). Original class video is at http://startupclass.samaltman.com/courses/lec13/

What skills does a founder need
Do not need be a genius or superman (most of the people are not).

  • Have something unique that helps you get an edge over others.
  • Has good leadership, is persuasive, and can create a network around you. Both are important to build the team.
  • Can articulate goals, and be clarity on missions

What will be a good number of co-founders?
2-3 co-founders with strong mutual trusts work well in most cases. Co-founders with diversified background and skills can complement each other. A startup faces many challenges. Multiple co-founders help provide different aspects into solving challenges, which makes the company more resilient. Collective problem solving, and learning are signs of a good founding team.

Where should I start a company ?
The place with the strongest network for solving the particular problem you want to solve.

How do I know the idea is good, aka a good contrarian?
Contrarian is something others do not believe in, while you do. Good startup ideas are mostly contrarian.  Contrarian is good if you see / know something while others do not. In early days of LinkedIn, ⅔ of friends do not believe in LinkedIn because, they think, it is hard for LinkedIn to reach a critical mass (1 mm users) to be useful. I (Reid) believed a professional public profile for users will be essential for everyone, and I know there are certain ways to grow network to a given size.

How to do Product distribution ?
For consumer products, it is all about competing for consumer time. So it is the key to figure out a decisive edge in your product, and use it to break through the noise.

how do I know when to pivot ?
If your confidence is unmeasured for a long time and decreasing, and things you can do to increase your confidence are all failing. This is a good time to pivot. Besides, founders do not have a work/life balance. They need be very focused, and work really hard because there are a lot of ways for the company to die.

How do VCs decide if someone is a good founder ?
Strong believer in references. Therefore, network is really key.