Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The following sub-sections describe the steps involved in creating a cartridge on the EC2 IaaS:

Table of Contents

Step 1 - Spawning an instance 

Prerequisites

PrerequisiteDescription
EC2 AccountTo follow this guide, you need an EC2 account. Create an AWS account if you do not have an account. For more information, see Sign Up for Amazon EC2. This account must be authorized to manage EC2 instances (including  start and stop instances, create security groups and key pairs). 
Create a security groupFor more information, see Creating a security group.
Create a key pairFor more information see Creating a key pair.

...

Before launching the instance, you need to create the right security group. This security group defines firewall rules for your instances, which are a list of ports that are used as part of the default Stratos deployment. These rules specify which incoming network traffic is delivered to your instance. All other traffic is ignored. The  For more information on the ports that should be defined are listed here: , see Required Ports.

To create the security group and configure it:

  1. On the Network and Security menu, click Security Groups.
  2. Click on Create Security Group.
  3. Enter the name and description of the security group.
  4. Click  Yes, Create .
  5. Click Inbound.
  6. Select "Custom TCP rule".

  7. Enter the port or port range.
    There are two kinds of ports listed in the common configurations, which are namely open for outside access and restricted internal access. You will have to ideally enter each of the ports as separate rules.
  8. Click Add Rule and then click Apply Rule Changes

    Always apply rule changes, as your rule will not get saved unless the rule changes are applied.
    Repeat steps 6 to 8 to add all the ports mentioned, as each port or port range has to be added as a separate rule.

    Info

    Note down the names of your security groups if you wish to enter your user data in the wizard. 

Anchor
Creating a key pair
Creating a key pair
Creating a key pair

...

  1. On the Network and Security menu, click Key Pairs.
  2. Click Create New Key Pair.
  3. Enter a name for your Key Pair.
  4. Click Create. After the Key Pair automatically downloads, click Close.
  5. Set the key pair permission as follows:
    chmod 0600 <KEY_PAIR_NAME>

Spawning an EC2 Instance

  1. Sign in to the Amazon Web Services (AWS) Management Console and open the Amazon EC2 console.     
  2. Click EC2 on the home console.
  3. Select the Region for the instance from the region drop down list.
  4. Click Launch Instance.

  5. Select  Quick Launch Wizard.

  6. Name your instance, for example 'StratosCartridgeInstance'.

  7. Select the key pair that you created.
  8. Select More Amazon Machine Images and click on Continue.

  9. On the next page, specify the image .
  10. Click Continue.
  11. Click Edit Details.
  12. Edit the image size. 
    1. Select the Instance Details option.
    2. Change the image type as required.
  13. Select a security group. 
    1. Select the  Security Settings  option.
    2. Click Select Existing Security Groups.
    3. Select the security group you have created previously.
  14. Click Launch  to start the EC2 instance.

  15. Click Close.
    This will redirect you to the instance page. It takes a short time for an instance to launch. The instance's status appears as pending while it is launching.  After the instance is launched, its status changes to running.

...

Excerpt

DevOps can create a cartridge either by using the quick guide or the detailed guide, as explained below:

Anchor
Quick
Quick
Quick Guide

Follow the instructions below to configure a cartridge image for OpenStack or EC2. These instructions describe how to create a cartridge from an existing Debian/Ubuntu based Linux 12.04.1 LTS image as a quick guide.

  1. Obtain a spawned instance in the respective IaaS to create a cartridge on top of it and start the image using EC2For more information on how to spawn as instance in EC2, see step one above.

  2. Use the complete set of instructions below to configure a cartridge image for WSO2 Private PaaS on Debian/Ubuntu based Linux 12.04.1 LTS  distributions:  

    Code Block
    sudo ­-i
    apt-get install zip unzip
    mkdir -p /root/bin
    cd /root/bin
    wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/puppet3-agent/config.sh;hb=HEAD" -O config.sh
    chmod +x config.sh
    wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/puppet3-agent/init.sh;hb=HEAD" -O init.sh
    chmod +x init.sh
    mkdir -p /root/bin/puppetinstall
    wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/puppet3-agent/puppetinstall/puppetinstall;hb=HEAD" -O puppetinstall/puppetinstall
    chmod +x puppetinstall/puppetinstall
    wget "https://git-wip-us.apache.org/repos/asf?p=stratos.git;a=blob_plain;f=tools/puppet3-agent/stratos_sendinfo.rb;hb=HEAD" -O stratos_sendinfo.rb
  3. Edit the /root/bin/puppetinstall/puppetinstall script to set the TIMEZONE value to match the timezone set on the Puppet Master.

    Info

    You can use the following command to set the timezone value. In this case we are setting the timezone to 'Etc/UTC':

    Code Block
    sed -i 's:^TIMEZONE=.*$:TIMEZONE=\"Etc/UTC\":g' /root/bin/puppetinstall/puppetinstall
  4. Execute the config.sh file and provide the stratos service-name, puppet master IP and puppet master hostname when prompted as follows:

    Info
    • stratos service-name - Enter one of the modules which are provided as templates in Stratos. For further details on the modules that can be used as values, see step 7(f) of Configuring Puppet Master. If you enter 'default', a generic cartridge will be created.

    • puppet master IP - Enter the IP address of the machine on which Puppet Master is configured.

    • puppet master hostname - This should be identical to the output received when running the hostname command. See step 5(b) of Configuring Puppet Master, for further details on executing the hostname command.

    Code Block
    This script will install and configure puppet agent, do you want to continue [y/N] y
    Please provide stratos service-name: php
    Please provide puppet master IP: 192.168.1.1
    Please provide puppet master hostname [puppet.test.org]: puppet.test.org
    Node Id 076227021438.default.php
    
    Domain puppet.test.org
    Running puppet installation with arguments: -n076227021438.default.php -dpuppet.test.org -s192.168.1.1

Anchor
Detailed Guide
Detailed Guide
Detailed Guide

Follow the instructions below to configure a cartridge image for OpenStack or EC2. These instructions describe how to create a cartridge from an existing Debian/Ubuntu based Linux 12.04.1 LTS image as a more detailed guide.

  1. Obtain a spawned instance in the respective IaaS to create a cartridge on top of it and start the Ubuntu image 12.04.1 using your IaaS. For information on how to spawn as instance in EC2, step one above.

  2. Navigate into your Ubuntu image using SSH and get root access.
    sudo ­-i 

  3. Install zip.
    apt-get install zip unzip

  4. Navigate to the root directory.
    cd /root

  5. Create a new folder named bin in the root/ directory.
    mkdir bin

  6. Create a config.sh file in the /root/bin/ directory, copy the configurations from the config.sh file, and save the file .

  7. Make the config.sh file executable.
    chmod +x config.sh

  8. Create an init.sh file in the /root/bin/ directory, copy the configurations from the init.sh file, and save the file.

  9. Make the init.sh file executable.
    chmod +x init.sh

  10. Navigate to the /root/bin/ directory.
    cd/root/bin/

  11. Create a new directory named puppetinstall in the /root/bin/ directory.
    mkdir puppetinstall

  12. Create a file named puppetinstall in the /root/bin/puppetinstall/ directory, copy the configurations from the puppet install file, and save the file.

  13. Make the puppetinstall file executable. 
    chmod +x puppetinstall

  14. Create a file named stratos_sendinfo.rb  inside the /root/bin/ directory Copy the configurations from the stratos_sendinfo.rb file and save the file.

  15. Execute the config.sh file and provide the s tratos service-name, puppet master IP, and puppet master hostname when prompted as follows:

    Info
    • stratos service-name - Enter one of the modules which are provided as templates in Private PaaS. For further details on the modules that can be used as values, see step 7(f) of Configuring Puppet Master. If you enter 'default', a generic cartridge will be created.

    • puppet master IP - Enter the IP address of the machine on which Puppet Master is configured.

    • puppet master hostname - This should be identical to the output received when running the hostname command. see step 5(b) of Configuring Puppet Master, for further details on executing the hostname command.

    Code Block
    This script will install and configure puppet agent, do you want to continue [y/N] y
    Please provide stratos service-name: php
    Please provide puppet master IP: 192.168.1.1
    Please provide puppet master hostname [puppet.test.org]: puppet.test.org
    Node Id 076227021438.default.php
    
    Domain puppet.test.org
    Running puppet installation with arguments: -n076227021438.default.php -dpuppet.test.org -s192.168.1.1

...

  1. Open the Amazon EC2 console

  2. Make sure the appropriate Region is selected in the region selector of the navigation bar.

  3. Click Instances in the navigation pane.

  4. On the Instances page, right-click your running instance and select Create Image.
  5. Fill in a unique image name and an optional description of the image (up to 255 characters), and click Create Image.

    Info

    In Amazon EC2 instance store-backed AMIs, the image name replaces the manifest name. For example, s3_bucket/something_of_your_choice.manifest.xml), which uniquely identifies each Amazon Amazon EC2 instance store-backed AMI.

    Info

    Amazon EC2 powers down the instance, takes images of any volumes that were attached, creates and registers the AMI, and then reboots the instance.

  6. Go to the AMIs page and view the AMI's status. While the new AMI is being created, its status is pending.

    Info

    It takes a few minutes for the whole process to finish.

  7. Once your new AMI's status is available, go to the Snapshots page and get the Snapshot ID of the new snapshot that was created for the new AMI, that will be used in the Sample Cartridge Definition JSON file.  Any instance you launch from the new AMI uses this snapshot for its root device volume.   
     
Info

After you finished creating the cartridge, make a note of the image ID you creates for the cartridge, as you will need this when you use Stratos Manager to deploy the cartridge. For more information on deploying the created cartridge using the Stratos Manager, see Deploying a Multi-tenant Service Cluster via the UI.