IBM DB2 Advanced on AWS

Amazon EC2 Installation and Support guide

1. Overview

This guide will provide step by step instructions how to start using the installed products on your AWS EC2 instance.

This AMI contains a ready-to-run IBM DB2 Advanced on AWS base image at the selected version. In order to use this image, you need to launch it with your selected type, and log in via SSH to create and configure your database. 

Visit the IBM DB2 Advanced Edition pages on the AWS Marketplace

2. Launching an instance

In order to launch IBM DB2, a few settings need to be configured on the AWS console as follows. The instructions for launching an instance differ depending on where you launch from. Initially you will launch the instance from the AWS Marketplace.

 

  • Select the IBM WebSphere Product based on your requirements in the AWS Marketplace;
  • Click on the link to go to that versions page in AWS Marketplace;
  • Check the ‘Other Versions ‘ link to see other versions available (you can select the actual version later).
  • Under ‘Pricing Details‘ panel select your Region, either Hourly or Yearly fees and instance type.
  • Click on the ‘Continue to Subscribe‘ ;
  • Accept Terms and click ‘Continue to Configuration
  • Select ‘Fullfilment Option
  • Click ‘Continue to Launch
  • On the ‘EC2 Instance Type‘ panel, choose the instance type. The m3.medium type or larger is recommended when running IBM DB2. Larger instances may be required based on your requirements;
  • On the ‘VPC Settings‘ panel Configure the VPC settings to your requirements or leave the defaults;
  • On the ‘Security Group‘ panel, specify the security group. The security group needs to permit to following ports [note that the internal firewall will be configured later to permit only ports used by WebSphere]:
    Port 22 to connect via SSH (enabled by default), 
    Port 50000 to connect to default database, Port 9090 to reach RapidDeploy web console, Port 20000 and 20100 to open for RapidDeploy Remote Agent (optional)
     
    • If you don’t already have a security group as above, go to your EC2 Control Panel and select ‘Security Groups‘ under ‘Network & Security
    • Click ‘Create Security Group‘ button
    • To open all ports, Click ‘Add Rule‘.
    • In the ‘Type‘ dropdown, Specify ‘All TCP‘ or your preferred configuration.
    • In the ‘Source‘ dropdown, Specify ‘Anywhere‘ or your preferred configuration. Remember to open also ports that will be used by your database (usually you 50000)
  • On the ‘Key Pair‘ panel, select a key pair to use. You will need this key later to connect to the instance.
  • Scroll back to the top of the page and click ‘Launch‘.
  • The Instance will be Launched.
  1. Select the IBM WAS AMI based on your requirements;
  2. Right click on the AMI, or from the drop down menu, choose the ‘Launch’ option;
  3. On the ‘Choose Instance Type‘ tab, choose the instance type.The m3.medium type or larger is recommended when running IBM DB2. Larger instances may be required based on the size of database required and the expected resource use of each; Click ‘Next: Configure Instance Details‘.
  4. On the ‘Configure Instance‘ tab Configure the instance to your requirements or leave the defaults. Click ‘Next: Add Storage‘.
  5. On the ‘Add Storage‘ tab, add additional storage as required or leave as default. Click ‘Next: Tag Instance‘.
  6. On the ‘Tag Instance‘ tab, Tag your instance with a suitable name. Click ‘Next: Configure Security Group'.
  7. On the ‘Configure Security Group‘ tab, specify the security group. The security group needs to permit to following ports:
    Port 22 to connect via SSH (enabled by default),
    Port 50000 to connect to default database, Port 9090 to reach RapidDeploy web console, Port 20000 and 20100 to open for RapidDeploy Remote Agent (optional)
     
    • To open all ports, Click ‘Add Rule‘.
    • In the ‘Type‘ dropdown, Specify ‘All TCP‘ or your preferred configuration.
    • In the ‘Source‘ dropdown, Specify ‘Anywhere‘ or your preferred configuration. 
  8. Click ‘Review and Launch‘.
  9. Review settings, then click ‘Launch‘.
  10. Add your key pair, Check the ‘Acknowledge key file access’ checkbox and click ‘Launch Instance‘.

 3. Initial login and setup

The IBM DB2 products are shipped with a base binary installation with default SAMPLE database created. On the first login to the instance, you will be placed into a console wizard, which will guide you through the process of initial configuration steps. The following is an overview of the steps you will be guided through to get started with the installed products on the instance. Once the instance has started up (you can see it by having ” 2/2 checks passed ” in EC2 console).
  1. Log onto the instance from the EC2 console or via SSH as the ‘ec2-user’ user, using the key you selected above.  For example:
    • From the EC2 console by clicking  the “Connect to your instance” button with username “ec2-user”, using the previously (instance launch-time) selected .pem keyfile.
    • Via SSH from your desktop, for example
      ssh -i ./MidVisionUSMC.pem ec2-user@ec2-52-87-198-23.compute-1.amazonaws.com
  2. You should see the MidVision banner and then you are placed in a setup wizard.
    Welcome to                                                                                                                                             
    
     __  __ _     ___     ___     _                    ____ _                 _
    |  \/  (_) __| \ \   / (_)___(_) ___  _ __        / ___| | ___  _   _  __| |
    | |\/| | |/ _` |\ \ / /| / __| |/ _ \| '_ \ _____| |   | |/ _ \| | | |/ _` |
    | |  | | | (_| | \ V / | \__ \ | (_) | | | |_____| |___| | (_) | |_| | (_| |
    |_|  |_|_|\__,_|  \_/  |_|___/_|\___/|_| |_|      \____|_|\___/ \__,_|\__,_|
    
                                                           A MidVision Service
    
            * WebSite: https://www.midvisioncloud.com/ibm-websphere-on-amazon-web-services/
            * Support: http://support.midvision.com/redmine/projects/devtestcloud
            * Forum:   https://www.midvisioncloud.com/community      
    
    Please run 'sudo su - db2inst1' to start using provided services.
    
    Welcome, this is MidVisionCloud RapidDeploy and  IBM DB2 image first run configuration
    
    Note that you can rerun this configuration wizard again by executing /home/db2inst1/firstrunsetup.sh script
    
    Configuration steps
    1. Set RapidDeploy framework initial password
    2. Open ports on RHEL firewall
  3. On the first login to the instance, you will be placed into a console wizard, which will guide you through the process of initial configuration. After logging onto the instance via SSH as the ‘db2inst1’ user you will be placed in a setup wizard. The following is an overview of the steps you will be guided through to create the required profiles on the instance:
    1. Set initial password for RapidDeploy user “mvadmin”.
    2. Choose which ports to open on Red Hat Linux firewall. You should open port 9090 for the RapidDeploy web console if required. You should open the required ports for default database, typically 50000.
    All inputs asking for specific data can be left as blank just by hitting  [return] , which will pick the default value displayed at the end of the question. Please refer to IBM documentation for DB2 configuration.
  4. The wizard finishes with the following output:
    Configuration finished, you may now start using RapidDeploy services and other software. Web user interfaces are available on:
    DB2 sample database JDBC url: jdbc:db2://[publicip]:50000/SAMPLE (use db2inst1 user credentials)
    RapidDeploy: [publicip]:9090/MidVision
    
    Note that initially db2inst1 user password is empty. You are free to change it if necessary.
  5. You can test the connection to db2 SAMPLE database using following commands:
    [db2inst1@ip-172-30-0-34 ~]$ db2
    (c) Copyright IBM Corporation 1993,2007
    Command Line Processor for DB2 Client 11.1.3.3
    
    You can issue database manager commands and SQL statements from the command 
    prompt. For example:
        db2 => connect to sample
        db2 => bind sample.bnd
    
    For general help, type: ?.
    For command help, type: ? command, where command can be
    the first few keywords of a database manager command. For example:
     ? CATALOG DATABASE for help on the CATALOG DATABASE command
     ? CATALOG          for help on all of the CATALOG commands.
    
    To exit db2 interactive mode, type QUIT at the command prompt. Outside 
    interactive mode, all commands must be prefixed with 'db2'.
    To list the current command option settings, type LIST COMMAND OPTIONS.
    
    For more detailed help, refer to the Online Reference Manual.
    
    db2 => connect to SAMPLE
    
       Database Connection Information
    
     Database server        = DB2/LINUXX8664 11.1.3.3
     SQL authorization ID   = DB2INST1
     Local database alias   = SAMPLE
    

4. Accessing the web console

4.1 Access the RapidDeploy Web Console

RapidDeploy server and agent will start up automatically when you start your instance. You can access the web console on:

http://[publicip]:9090/MidVision

Note: make sure you have port 9090 open in your Security group when trying to access RapidDeploy web console. For the first time, you can set the password for the default username ‘ mvadmin ‘. You can prevent auto starting RapidDeploy on instance startup by removing it from the system chkconfig list.

[db2inst1@ ] sudo systemctl disable rapiddeploystart.service
 

5. Maintaining the installation

The following sections cover some of the activities you might want to perform after the instance has been started.
  • db2inst1: This is the default user, which you can log in as. It is permitted to use all SUDO rights. To switch to the root user, type “sudo su“.
  • root:      This is the superuser in linux systems. You can log in as any other user without using passwords. E.g: “su ec2-user“, “su db2inst1
  • ec2-user:  This user has also SUDO rights. If you want to switch back to root user, type “exit“, this will take you back to the previous user session.

RHEL instances are shipped with a firewall by default to protect your machine. For security reasons, the instance is only accessible via SSH (port 22) at first, so further ports can be opened on the firewall as needed. You will need to open all the ports in this internal firewall, which you have open in your Security group. There is a script placed in the user home of the db2inst1 user (/home/db2inst1), which is also the starting location when logged in. You will need to be the root user to run this script. Example usage:

[db2inst1@ ] sudo ./open-firewall.sh 9090
Open firewall port 9090 iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
 

There are a few scripts and other files in db2inst1 and root users home directory, which will need to remain unchanged in order to keep the provided scripts working. There are a set of scripts in db2inst1 home directory. Those scripts are executed when logging into the instance controlled by  .bash_profile , but you can also execute them manually whenever they are needed. There are some hidden files used as well,  .firstrun  indicates that the setup wizard has already ran once.

To restart RapidDeploy manually from the filesystem, use the rapiddeploy linux service. The RapidDeploy version is 5.0.5. RapidDeploy home is located at /var/rd/midvision Example usage:

[db2inst1@ ] sudo service rapiddeploystart start 
[db2inst1@ ] sudo service rapiddeploystart stop

The RapidDeploy server uses an in-memory database, so your RapidDeploy framework needs to be shut down properly to save your work. This happens when the instance is stopping or when calling the stop service manually from the command line. Note that on instance restart, unsaved data will be lost.

For security reasons, you will need to change the default password (default value is ‘[instance-id]‘) for user mvadmin. This will be requested the first time only when you log in to the RapidDeploy server.

6. Troubleshooting

6.1 Session loss during setup

If you lose your SSH connection to the target instance during the first run setup script execution (e.g. as a result of a network problem), we advise you to delete and recreate the EC2 instance and run the script again.

6.2 Contacting MidVision support

Please visit our support website.