Confluence and JIRA on Amazon EC2: Hook Up to DynDNS

If you installed Confluence and JIRA on Amazon EC2, you can add a stable domain name to your installation with DynDNS, so that it doesn't change each time you stop and start your server.

Ads by Google

Confluence Jira Amazon ec2www.atlassian.com

Confluence, JIRA, Amazon EC2 and DynDNS

There is an article at Atlassian on how to add a stable domain to an Amazon EC2 instance by utilizing an elastic IP. If you use that, Amazon is going to charge you. There is another way to do that – by utilizing a free dynamic DNS update service, in our case – DynDNS.

*** There is one problem though. If you follow the instructions below, you’ll need to create a new server image (see the bottom of this page for a link) and you will no longer be able to use the instant-atlassian start/stop scripts.

To achieve that you need to

  1. Setup an account with DynDNS
  2. Create or add a domain that you want to use
  3. Install a dynamic DNS client on your Amazon EC2 server
  4. Starting ddclient for the fist time
  5. To make the client start automatically on server boot
  6. Create a new server image.

1. Setup an account with DynDNS

This is the easiest part. Just go to www.dynDNS.com Dynamic DNS Free page and click “Get Started”. Follow the prompts to create an account (if you don’t already have one). Do the usual activation thing through email link, and login to your new account.

2. Create a domain that you want to use

The fist time you login, you’ll see “Add New Hostname” page. Add a subdomain you like and chose one of the multitude of available domain names. Tick “Create wildcard” option and select “Host with IP address”. Enter a dummy IP address to start with (e.g., 10.10.10.10) – this will update when you boot up your Amazon EC2 server.

DynDNS Setup

Click “Create Host” then “Payment” – since it’s a free service, you won’t be charged, this is just to activate your service, and then, “Activate Services” button. Ok.. it’s done.

3. Install a dynamic DNS client on your Amazon EC2 server

I assume there will be a number of people who never used shell or linux vi text editor. So, to make it easier, we’ll do it using Windows and Windows software programs.

3.1. Download ddclient

First, you need to download the ddclient – a dynanic DNS client package, written in Perl. This can be downloaded from the DynDNS web site. You’ll have a file called ddclient.tar.gz. I normally use WinRAR (also a free program) to unpack tar.gz files. Depending on the ddclient version, after unpacking you’ll have a folder called “ddclient-3.7.3”. Rename this folder to just “ddclient”.

3.2 Create or edit ddclient config file

In the ddclient folder, open the sample-etc_ddclient.conf file (using Wordpad, to preserve line breaks) and save it as ddclient.conf.  Copy the text below to the bottom of that file, substituting login and password xxxxx with your DynDNS login details and xxxxxx.dyndns.biz with the hostname that you created at DynDNS.








3.3 Connect to the server.

In my view, the best program to move files from a Windows machine to a linux host is with WinSCP. It’s a free SCP/SFTP/FTP client that can be downloaded from WinSCP website. You’ll need your current Amazon EC2 URL and the private key for this instance. The URL is easy – you get it each time you start the instance. But the private key… if you didn’t save it when you first created the server, I’m afraid, you’ll have to recreate the server again, so that it generates new key pair (***Please correct me if I’m wrong. I haven’t found a way to assign a newly created key pair to an existing instance).

When you first create a new server, you’ll get something that looks like this:

Created private key instant-atlassian:
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAoMAxZJwqHBGTtcLbiKm5qKI
....
5l5HqKKToJJGXqGwnHbM8b98ElsRQ5PLH96RBSB
-----END RSA PRIVATE KEY-----

You need to copy text from “—–BEGIN RSA PRIVATE KEY—–” to “—–END RSA PRIVATE KEY—–” (including these lines) and paste it to a text file and save it as “instant-atlassian.ppk” This is the “key” to your server.

Now. To use this key with WinSCP, we need to convert it to a format that WinSCP can recognize. For that, you need to download PuTTYgen. Start PuTTygen, and import the above mentioned key by going to “File” > “Load Private Key”, select the file (instant-atlassian.ppk) and click ok. Then you need to go to “File” > “Save Private Key”. Save it in the same directory, with a different filename, e.g., “instant-atlassian-putty.ppk”

Now, open WinSCP and enter the connection details:
Host Name: Your Amazon EC2 instance URL, without the http:// – e.g., ec2-xx-xx-xx-xx.compute-1.amazonaws.com
User Name: root
Password: leave empty
Private Key File: browse and select the newly generated key, e.g., instant-atlassian-putty.ppk
File Protocol: SCP

Click Login. It may take a while, you may need to confirm the details and then you’ll see the file directory of your Amazon EC2 server in the right hand side window.

3.3 Upload the ddclient files to the server.

3.3.1 In the right hand side window, navigate to the folder /usr/sbin (be patient! it may take a few seconds for the directory structure to update). Find the ddclient file in the ddclient folder on your computer and copy it to the server (drag it across). Make the file executable: right-click on the file, select “Properties”, type 0755 in the “Octal” field and click OK.

3.3.2 Navigate to the /etc/ folder on the server and create a new folder called “ddclient” (select the right hand side window and click “F7 Create Directory” icon at the bottom of the WinSCP screen). Also, navigate to the /var/cache folder and create a new “ddclient” folder there too.

3.3.3 Navigate to /etc/ddclient/ directory and copy the ddclient.conf file that you created above.

4. Starting ddclient for the first time.

Go to the ddclient directory on your computer and rename the file “sample-etc_rc.d_init.d_ddclient” to “ddclient” (you may need to copy the file to a different directory so that it doesn’t overwrite other files with the same name). Copy this file to the “/etc/rc.d/init.d/” folder on the server. Make the file executable: right-click on the file, select “Properties”, type 0755 inthe “Octal” field and click OK.

Now, you need to install perl-IO-Socket-SSL module on the server for ddclient to work. In WinSCP click on the little black terminal icon at the top of the WinSCP (or press Ctrl-T).

winscp-terminal1

Execute this command:

yum -y install perl-IO-Socket-SSL.noarch

Now, start ddclient for the first time (execute from the terminal window too):

/etc/rc.d/init.d/ddclient start

To see if it’s running, execute

/etc/rc.d/init.d/ddclient status

5. To make the client start automatically on server boot.

To make sure that ddclient starts automatically at boot and updates the IP address, execute this command:

/sbin/chkconfig --add ddclient

That’s it! Login to your DynDNS account, go to “My Account” > “Host services” and you should see your new Amazon EC2 IP already there! Now you can access your Confluence and JIRA on Amazon EC2 with the same URL, no matter how many times you restart it.

6. Create a new server image.

However… having done all that, you’ll need to create a new server image, otherwise, all these changes that you did, will be lost if you reboot the server. For more info – go here and see “Create an Image” page.

Related Articles

Looking For More Information?

Make sure to explore other articles in the Software category or contact us to suggest a website or a service to review.
 

Ads by Google

The review "Confluence and JIRA on Amazon EC2: Hook Up to DynDNS" was last updated on 20/05/2009.