Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Getting Started with CUBRID Database AMI (Amazon Machine Image)


For those users looking to seamlessly deploy CUBRID Database on Amazon Web Services (AWS), we have created Amazon EC2 Machine Images (AMI) with CUBRID and its APIs installed. In this tutorial I will explain the key steps you need to perform in order to get everything started on AWS. We will:

  1. Review available CUBRID AMIs.
  2. Review the software stack of the CUBRID AMI.
  3. Create an account on Amazon Web Services.
  4. Launch your instances based on CUBRID AMI.
  5. Configure your instance.

CUBRID AMI

The following is a list of CUBRID AMI we (owner ID: 024941853939) provide officially. We distribute CUBRID AMIs to all available regions (if a new region is available and we do not distribute there, let us know and we will add it as well). Shortly we will add AMIs based on other Linux distirbutions as well.

Owner ID CUBRID Version OS Root Device Image Size AMI ID EC2 Region
024941853939 CUBRID 8.4.3.1005 x64 Ubuntu 12.04.1 x64 EBS 8GB ami-cd8713a4 us-east-1 (N. Virginia)
= = = = = ami-5aea606a us-west-2 (Oregon)
= = = = = ami-6ae4c72f us-west-1 (N. California)
= = = = = ami-9ee3edea eu-west-1 (Ireland)
= = = = = ami-980c41ca ap-southeast-1 (Singapore)
= = = = = ami-77c14576 ap-northeast-1 (Tokyo)
= = = = = ami-ee5accd4 ap-southeast-2 (Sydney)
= = = = = ami-039c471e sa-east-1 (São Paulo)

I will explain how to use these Amazon Machine Images below. First, let's see what software will be available for you in this Amazon Machine Image.

Software Stack

OS

  • Official Ubuntu 12.04.1 (precise) x64 LTS cloud AMI distributed by Canonical (AMI ID: ami-8e109ebe; note, this is not CUBRID AMI ID).

We will soon provide CentOS based CUBRID AMIs.

Default software

The following software is installed on Ubuntu 12.04.1 by default.

  • Python 2.7.3 with pip 1.0
  • Perl 5.14.2 with CPAN 1.57

Custom software

Now here we have installed the software necessary to work with CUBRID Database Server. 

  • CUBRID Database Server 8.4.3.1005 x64
  • Python driver v8.4.3.0002
  • Perl driver 8.4.3.0001
  • PHP 5.3.10 with PECL/PEAR
  • PHP driver 8.4.3.0001
  • PDO driver 8.4.3.0001
  • Apache HTTP Server 2.2.22 (installed automatically by PHP)

These are all you need to get started with CUBRID Database on Amazon Web Services.

Getting Started

Create an account on Amazon Web Services

If you already have an AWS account, you can skip this step and continue. If you do not have one:

  1. Go to http://aws.amazon.com, and click on the Sign Up button. Sign in to your existing AWS account or create a new one.
  2. Go to http://aws.amazon.com/ec2 and clck on teh Sign Up Now button. If it is the first time you are signing up, you may be eligible for free 750 hours of Micro instance every month for one year.
    1. Enter your credit card information and complete your signup for the Amazon EC2 service. It takes from several hours to couple of days for your EC2 account to set up. Eventually you should receive a confirmation email from Amazon Web Services.
  3. Once you have your EC2 account set up, go to EC2 Web Console.
    1. Create a key pair. You will need this key pair to launch EC2 instances and connect to them via SSH. The public key will remain in your EC2 account, while you will use the private key when establising an SSH connection to newly created instances.
      1. Click Key Pairs under Networking and Security in the Navigation pane and then click the Create Key Pair button (save it in e.g. ~/.ec2/ec2.pem). Download the private key. You will not be able to download it later. Do it now!
    2. Set up your Amazon API credentials. For this you need to create a new certificate.
      1. On the top right corner of the EC2 page go to the menu displayed by your name, there choose Security Credentials.
      2. Under the Access Credentials click on the X.509 Certificates tab.
      3. Create a new certificate.
      4. Once created, download the private key and the certificate (save them in e.g. ~/.ec2/cert-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem and ~/.ec2/pk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem).
      5. Make your credential files private. In your command line type:
        chmod go-rwx ~/.ec2/*.pem
      6. If at a later time you need to create a new certificate, you can come back here and create a new certificate again.

    Congratulations! Now you are ready to create your first Amazon EC2 instance.

    Launching CUBRID Instance

    There are different ways you can find and launch CUBRID Amazon Machine Images. Below I will explain two ways:

    • From AWS site
    • From your EC2 Web Console

    From AWS site

    You can navigate to http://aws.amazon.com/amis/cubrid-8-4-3-sql-database-ebs-64-bit-ubuntu-12-04-1 public AMI listing and press the Launch Instance button from there. Then continue as described below.

    aws_cubrid_ami_public_listing_8.4.3.png

    From your EC2 Web Console

    1. Go back to your EC2 Web Console.
    2. At the top right corner of the page you will see a dropdown menu with a list of availability zones. Switch to the one you think is most suitable for your needs.
    3. Once the Web Console is refreshed, you will see a Launch Instance button. Press it in order to see the Launch Wizard.
    4. Select the Classic Wizard and press Continue.

    Configure EC2 Instance

    1. Now you need to choose one of CUBRID AMIs.ins
      1. Press on the Community AMIs tab.
      2. In the search box type cubrid or directly enter one of the CUBRID AMI IDs available in that region. The system will list matching AMIs as shown in the schreenshot below.
        aws_choose_cubrid_ami.png
      3. Make sure the owner ID is 024941853939. You can find it the Manifest field as shown above. This owner ID proves that the selected AMI is created by us, the CUBRID Team, and we will provide support. In case another owner ID is set for some of our CUBRID AMIs, we will mention so in the table above.
      4. To select the desired CUBRID AMI, press the Select button on the right of that image.
      5. Next, configure your instances.
        1. Choose the number of instances. In this tutorial we will choose to launch only 1 instance.
        2. Then choose the Instance Type you want to launch. Each type differs in CPU units, CPU cores, Memory, and Price. You may want to check out the EC2 Pricing to make the right decision. For this tutorial we will choose the smallest T1.Micro instance which provides 613MB of memory and up to 2 EC units (for short periodic bursts). Notice, though, that this Micro instance does not guarantee 2 EC units. In fact, it will provide only short periodic bursts of 2 EC units, and often it will fall way below the expectation. For more details and test results on this matter check out Greg Wilson's blog about Amazon EC2 Micro Instance and Stolen CPU.
        3. Next, you may choose between Launch Instances (the normal EC2 instances) and Request Spot Instances. If you are just beginning, I suggest you go with a common Launch Instances option. This is what we will do in this tutorial.
        4. Availability Zone: if you have no preference on where exactly in your current region should the instance launch, simply leave it as No Preference.
        5. Once done, press the Continue button.
          aws_cubrid_ami_details.png 
      6. Next, the Launch Wizard will show Advanced Options. You may leave everything with the default settings, and press Continue.
        aws_cubrid_ami_advanced_options.png
      7. Storage Device Configuration: the defult configuration of the CUBRID AMI will attach an 8GB EBS volume storage device (default from Ubuntu by Canonical) to the newly launched instance. You may leave it with the default settings, or if necessary change it by pressing on the Edit button. When done, press on the Continue button.
        aws_cubrid_ami_storage_device.png 
      8. Next, add tags to your instance. For example, you can give a Name to your instance such as My new instance with CUBRID 8.4.3 or something of that sort. Then press the Continue button.
        aws_cubrid_ami_tags.png
      9. Now you need to choose the Key Pairs to let the EC2 know which keys will allow users to access this instance via SSH. Now, you have already created your Key Pair above when you created your EC2 account, have not you? If you have previously created your Key Pair and you have the private key downloaded, then choose it from the given list as shown below. If you have not created the Key Pair before or want to create a new one now, then choose the Create a new Key Pair option, and create one. In this tutorial, I will use the previously created Key Pair. Remember, that once you set this Key Pair in this step, you will not be able to change it after the instance is launched.
         aws_cubrid_ami_key_pairs.png
      10. Next, Configure the Firewall.
        1. If you have not created any Security Group before, you will be given a Default group as shown in the following screenshot. This default security group restricts any kind of access to this instance from outside. But we will not choose it. Instead, we will create a new Security Group specifically for CUBRID Database usage. So, continue reading.
          aws_cubrid_ami_firewall.png
        2. We will create a new Security Group to open CUBRID database related ports. So choose the Create a new Security Group option.
          1. For a Group Name enter CUBRID for you to know what this Security Group is related to.
          2. Group DescriptionOpen CUBRID Database related ports.
          3. Choose Custom TCP rule.
          4. Enter 8001-8003 to a Port range.
          5. Leave Source as 0.0.0.0/0. This tells EC2 that the above specified port will listen to connections from any IP. If you want to limit only specific IP to have an access to this instance, enter the IP here.
          6. Once done, press the Add Rule button.
          7. Now repeat the last 3 steps to enter separate rules for 30000, 33000, 8282, 1523 ports as shown in the screenshot below.
          8. Finally open the SSH port 22. This time choose SSH from the Create a new rule dropdown box and press on the Add Rule button.
          9. We are done! Press the Continue button.
            aws_cubrid_ami_firewall_cubrid.png
      11. Now, Review the Summary. If necessary, you can go back and customize any option as you wish. Once ready, press the Launch button to take off.
        aws_cubrid_ami_summary.png 

    Quite a long way but you have made it! So, congratulations with your new CUBRID Instance! In fact, you can apply the same process with any other AMI distributed by other vendors.

    SSH Connection

    Now let's connect to our CUBRID Amazon Server via SSH and have a sightseeing tour! For this we need two items:

    1. A Private Key.
    2. A Public DNS

    Private Key

    The first thing to remember is that we have opened SSH port 22 in our "CUBRID" Security Group (step 5.10 above). This means we can connect to the newly created instance right away with our private key. In fact, only those users who posess this private key that matches the public key assosiated with the newly launched instance can access this instance. Just to remind you, once you have set a Key Pair during the instance initialization step, you will not be able to change it.

    Public DNS

    In order to connect to our remote Amazon EC2 instance, we need to know either the IP address or the Public DNS attached to that instance. You can find the Public DNS of your instance if you go to https://console.aws.amazon.com/ec2->Instances->My new instance with CUBRID 8.4.3.

    Once you select your instance a detailed description will be displayed below it. You can find your Public DNS there as shown below.

    aws_cubrid_ami_public_dns.png

    Establish SSH connection

    So, we now have both the private key and the Public DNS. Let's establish an SSH connection.

    $ ssh -i MY_PRIVATE_KEY_FILE.pem ubuntu@MY_PUBLIC_DNS
    The authenticity of host 'MY_PUBLIC_DNS (MY_PUBLIC_IP)' can't be established.
    RSA key fingerprint is dc:17:a9:ca:b8:c4:e5:59:f3:e4:8a:1a:03:cb:94:9e.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'MY_PUBLIC_DNS,MY_PUBLIC_IP' (RSA) to the list of known hosts.
    Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-31-virtual x86_64)
    
     * Documentation:  https://help.ubuntu.com/
    
      System information as of Tue Jan 29 08:33:09 UTC 2013
    
      System load:  0.08              Processes:           64
      Usage of /:   14.9% of 7.87GB   Users logged in:     0
      Memory usage: 8%                IP address for eth0: 10.248.26.17
      Swap usage:   0%
    
      Graph this data and manage this system at https://landscape.canonical.com/
    
    80 packages can be updated.
    35 updates are security updates.
    
    Get cloud support with Ubuntu Advantage Cloud Guest
      http://www.ubuntu.com/business/services/cloud
    ubuntu@ip-MY_INTERNAL_IP:~$

    Thus, we are in!

    Check CUBRID

    Check CUBRID Server Status

    The first thing you can do is check the status of CUBRID Database Server.

    ubuntu@ip-MY_INTERNAL_IP:~$ cubrid service status
    @ cubrid master status
    ++ cubrid master is not running.
    @ cubrid server status
    ++ cubrid master is not running.
    @ cubrid broker status
    ++ cubrid broker is not running.
    @ cubrid manager server status
    ++ cubrid manager server is not running.

    Since we have not yet started the CUBRID Service, everything is stopped.

    Start CUBRID Server Status

    Start the CUBRID Service status:

    ubuntu@ip-MY_INTERNAL_IP:~$ cubrid service start
    @ cubrid master start
    ++ cubrid master start: success
    @ cubrid broker start
    ++ cubrid broker start: success
    @ cubrid manager server start
    ++ cubrid manager server start: success

    CUBRID Master, Broker and Manager Server services will start up.

    Now, if you had created a database before and have set to auto start it, the CUBRID Server service would also start which would start the specified database.

    Notice, that in case you restart your EC2 instance, you will need to start CUBRID Service manually each time as it is not set to start on system startup.

    Conclusion

    In this tutorial you have learnt how to find and launch Amazon EC2 instances based on CUBRID Amazon Machine Images. We provide CUBRID AMIs on all regions. Now go straight to CUBRID Tutorials and proceed to creating your first CUBRID database. For Driver related tutorials visit the CUBRID APIs wiki page.

    If you ever need any help or have a question, feel free to comment below, ask a question at CUBRID Q&A site or forum, Facebook or Twitter, or at #cubrid Freenode Web Chat.

    comments powered by Disqus
    Page info
    viewed 4910 times
    translations en
    Author
    posted last year by
    Esen Sagynov
    Contributors
    updated last year by
    View revisions
    Share this article