Sunday, November 23, 2014

Setting up Domain Name on AWS Route 53

If you want to host a web site on AWS, the first thing you need to do is get your domain name set up. There are basically three steps to this process:
  1. Register a domain name (if you need a new one). 
  2. Setup DNS records in Route 53.
  3. Tell the registrar what DNS servers to use for your domain.  
DNS just tells computers on the Internet where to find your web site. If you want to know more read this: http://en.wikipedia.org/wiki/Domain_Name_System

Amazon's DNS service is called Route 53 It has 100% up time guarantee: 

There are two options for registering a new domain and setting up in route 53:

1. Register the domain name with Amazon

2 Register with a third party service and tell the other company to use Amazon servers for DNS.

Option 1: Register Domain Name with Amazon

1. Log into Amazon and click on Route 53



2.Click "Registered Domains" on left. Then click register domain



3. Follow the instructions to enter contact information and register the domain

4. At the end of this process the domain is under "pending registrations". It took less than 30 minutes for my domain registration to complete.

5. Once complete, the domain showed up under "Registered Domains" and  DNS servers were immediately associated with my domain.



6. Click "Manage DNS"



7. Click on the domain name you just registered in the list of  "Hosted Zones". Note that there is a comment that says this entry was created automatically by Route 53.



8. Follow the instructions below to set up DNS entries to point your domain name to your web server. See: Set up DNS records on Route 53

Option 2: Register your domain name with a third party

1. Register your domain with a third party registrar such as https://www.networksolutions.com/ and https://www.godaddy.com/

2. During or after registration, or for an existing domain name, you will need to tell the registrar which DNS servers to use for your domain (what was done automatically when the domain name was registered with Amazon in step 5 above).

3. To obtain AWS DNS server information - Click on Hosted Zones on Left and Create Hosted Zone:



3. On the right side of the screen enter the domain name and click "Create".




4. After you click "create" (or if you click the name of your hosted zone in the list of hosted zones you created) you'll get a screen which gives you four DNS server names. These are the server names you'll need to enter at the third party registrar to associate your domain name with AWS Route 53 DNS servers.



5. Follow the instructions in the next section to associate your domain name with your web server.

Set up DNS records on Route 53

At this point you have a domain name that belongs to you. You either registered at Amazon and the domain was automatically associated with DNS servers, or you associated your domain with the AWS Route 53 DNS servers by entering them at your third party registrar.

Now you need to edit your DNS records to tell the world what IP address to go to in order to see your web site.

1. Within Route 53 in the AWS console click on "Hosted Zones".

2. Click on your domain name and then "Go To Record Sets".



3. For a new domain you will see the associated name servers (NS record) and an SOA record:



4. Add an "A" record and specify which IP address someone on the Internet should go to in order to see your web site. Click "Create Record Set". Leave Type = A (default), enter an IP address (e.g. an elastic IP pointed to something hosted at Amazon or the IP address of a server not hosted by another company) and click "create".




5. In the example above I associated the domain nebulous.ventures with an IP address. I probably also want people to get to my web site if they type in www.nebulous.ventures so I will create an A record for that the same way except that I specify "www" in front of the domain name.



6. EMAIL: If you want to have email addresses associated with this domain you'll need to set up "MX" records. For example if you are using gmail you would get the MX records from them when you set up your service with Google and plug them in here to tell the world to send email from this domain name to the gmail mail servers.

7. SPAM: If you set up email you will want to set up an "SPF" record to tell the world which IP addresses are allowed to send email for this domain. This tells people who receive email from your domain if it is valid or not. If you do not have SPF records set up or they are incorrect your mail may go to spam folders. SPF records are beyond the scope of this blog post - your email provider should tell you how to set these up.

8. CNAME: For some Google services they ask you to enter a CNAME record to prove you own the domain you are trying to use with their services. This is where you would enter that CNAME record.
 

FYIs:

It will take some time for your web site to be visible at your domain, because the changes you put into Route 53 have to be propagated to all the DNS servers around the world.

You can transfer a domain you already registered to Amazon Route 53 but this is not required to use the service.

The instructions above also work with domains you already have registered.

For some registrars, when you change DNS records, they take your site offline for a period of time until the DNS entries update to the new DNS servers, so you may want to create the AWS records first, and get the DNS servers to enter while you are registering the domain.

I found some types of domains to be cheaper at my existing registrar, some cheaper on Amazon.

If you host your domain at Amazon and give someone access to Route 53, they could have the ability to transfer your domain away from you. Make sure you set up permissions appropriately in the console. Registering at a third party and not giving the people who manage things in the AWS console also prevents this.

Multi-factor authentication for your AWS account is, as always, recommended to protect assets accessible in the AWS console.

A domain name registered with Amazon initially has the status "client transfer prohibited". This will hopefully go away in 60 days.

Thursday, September 04, 2014

Create a GitHub Respository and Get Code In it

Quick way to get your code in GitHub

These steps work on Windows.

1. Create an account on http://github.com

2. Recommend multi-factor authentication to require you to enter a pin from your cell phone

     a.  Click on the settings icon :
    b. Click on security on the left

    c. Turn on two factor authentication at the top middle of the screen and follow the instructions to activate.

3. Install the client software. 



4. Create a repository on http://www.github.com
   
    a. Click on repositories in the left menu

    b. Click the plus button (next to the settings button above)
  
    c. Choose New Repository from the download

    d. Type a name for your repository
   
    e. Choose public if you want the world to see your code, otherwise private radio button.

    f. Click create repository.

4. Create the local repository
   
    a. On the repository page, click set up in desktop.

    b.  Click "launch application"

    c.  Create a new folder where you want to have the folder for your repository created.

    d. Click to select the location

    e. A folder will be created with the name of your repo inside the folder you selected and a .git folder
  
    f. Do not alter the git folder - that is used to sync your files with git

    g. Move the files you want to put into github into the repository folder.

5. Ignore things you don't want to go to github

    a. in the root folder of your repository create a file called .gitignore 

    b. in windows right click on the repository folder and choose Git Bash

    c. type on command line: touch .gitignore
    
    d. type the names of files you want to exclude from going to github http://git-scm.com/docs/gitignore

    e. suggest including: encryption keys, logins, AWS keys, other types of credentials, sensitive data

6. Create a Branch (if you want)

   a. Go back to your repository on github

    b. click the down arrow next to master at the top

    c. enter a new branch name

7. Add files to Github in the branch you just created
   
    a. Check the box next to files you want to move to git in your file list

    b. Enter a summary (required) and comment (optional)

    c. Click "Commit to [branch]"

    d. The files are now listed under "Unsynced changes"

    e. Click Publish in top right of the screen to move the files to the server.


Troubleshooting:

- if you have existing attempts to put into github and try to reuse you will probably have conflicts. Make sure to remove the .git directory, if any, from existing code before moving to your new repository directory

- can't create a file staring with . in Windows so use the Git Bash (not command window) as noted above to create the file.

- You cannot create a repository and sync it using the method above if there are existing files where you are trying to create the repository - it's just easier to start with a new directory and move code into it if having issues.

I'm sure there are many other ways to do this - this is what worked quickly for me.