EC2

Revision 2 as of 2009-09-17 15:42:51

Clear message

Ubuntu EC2 Test Plan

EC2 is the Amazon Elastic Compute Cloud, providing scalable virtual private servers using Xen. Canonical provides Ubuntu AMIs (Amazon Machine Images). The aim of these test plan is to provide a comprehensive testing guide of the Ubuntu official images.

Payment

Amazon has a per use billing system for their cloud, this offers some challenges since there's no simple way for us to just pay for EC2 usage and dole it out to testers. Here are some ways we could deal with this:

  • User pays, Canonical Reimburses
    • The user just uses EC2, tests our images, and then asks Canonical for a reimbursement, like an expense.
    • Pros:
      • No credit card or account management needed on our end, if we want to cancel a tester we just tell them we won't pay for any more time and not reimburse.
      • User has motivation to ensure they don't leave instances running all night if they have to pay up front.
    • Cons:
      • Admin overhead for HR
      • User has to pay out of pocket upfront, could make people wary of signing up/helping.
  • One Canonical account shared by all testers (This idea is the worse one I think)
    • We make one ec2 account with a common login/password connected to the Canonical credit card.
    • Pros:
      • Easy to set up, no overhead for users.
    • Cons:
      • Anyone can just shutdown and create each other's instances.
      • No way to track who is doing what, so if one user spawns 50 instances and leaves them running we have no idea who is responsible.
      • Obvious security problem with the account credentials and CC.
  • Seperate Canonical-created accounts for each tester billed to Canonical.
    • Pros:
      • Low user barrier to entry.
      • Some semblance of user access control.
    • Cons:
      • Won't scale if we have to manage all these accounts.
      • User can change the password if they want so we can't really shut someone off if they are determined.
  • Ideas pursued but not possible:
    • Amazon gift cards sent to testers, can't use them for EC2. Sad :(

    • Amazon DevPay, would work if we were "reselling" services to customers, no method to prevent testers from getting charged.

    • Asked amazon via a webform for help (Pending)
    • Phone support not available without signing up for Silver/Gold tech support.
  • Random things about EC2 that you should know:
    • Charges credit card at the end of the month, however you can monitor billing (about a 24 hour delay)
    • When experimenting with accounts and what charges what the lag between doing stuff and it showing up on the account activity is enough to make trying new methods a long process.

If you had never run an Ubuntu EC2 image, you should look to our starters' guide

Reporting bugs

Testers for the EC2 testing project should be members of the Launchpad team https://edge.launchpad.net/~ubuntu-ami-testers.

Bugs will be reported in the https://edge.launchpad.net/ubuntu-ami-testing. The Server team will be responsible afterwards of reassigning the bugs to the correct project or Ubuntu package.

Test Results

QA team wants to build a tool for this: https://wiki.canonical.com/CoP/QA/ToolRequirements However, the wiki will be used to record results because the tool isn't made yet.

Smoke Tests

Smoke should be run before any other, to check for the sanity of the image.

Register

Case ID: ec2-001

  1. Register an instance of the image to test
  2. Expected results: the image exists and it can be registered.

$ ec2-describe-instances

Root login

Case ID: ec2-002

  1. Try to ssh the new instance as root

ssh -i /path/to/ec2-keypair.pem root@<external-host-name>
  1. Expected results. The login is refused and you get the error message:

Please login as the ubuntu user rather than root user.

Ubuntu login

Case ID: ec2-003

  1. Try to ssh the new instance as the ubuntu user

ssh -i /path/to/ec2-keypair.pem ubuntu@<external-host-name>
  1. Expected results:
    1. The login is accepted and you log into the new instance
    2. Password less sudo access is available for the ubuntu user:

$ sudo -l
User ubuntu may run the following commands on this host:
    (ALL) NOPASSWD:ALL

Availability Regions

EC2 instances run in different data centres in two regions:

  • us-east-1 - East coast of the United States (probably near Washington, DC)
  • eu-west-1 - Western Europe (probably near Dublin, Ireland)

Changing the default region

Case ID: ec2-004

  1. Get a list of the available zones:

ec2-describe-availability-zones
  1. Register an instance of the image to test, changing the zone using the -z parameter.

  2. Expected results:
    1. The image exists and it is registered in the selected zone.
    2. APT is setup to use the EC2 archive mirrors corresponding to the instance availability zone (eg. us zones use the us mirror) in /etc/apt/sources.list

Rebundle

EC2 allows to rebundle a running EC2 instance into a new AMI, and use this new AMI to create new instances based on it.

Small rebundle

Case ID: ec2-005

  1. In your running instance, create a small text file in the $HOME folder called test.rebundle
  2. Rebundle the image following the instructions at http://alestic.com/2009/06/ec2-ami-bundle

  3. Create an instance using the newly created image and ssh to it.
  4. Expected results:
    1. The instance can be created and the test.rebundle is available in the $HOME folder.

Big rebundle

Case ID: ec2-006

[TBC] What kind of applications should be installed in this kind of test?

User Data

Basic User Data

Case ID: ec2-007

[TBC] Create a user data script with a minimal test case for user data.

Bind9

Case ID: SWI-008

[TBC] Create a user data script that installs and runs bind9

  1. Confirm that bind is running:
    • pgrep named
      should return the pid of named.
  2. Confirm that bind is listening for IPv4 and IPv6:
    • sudo netstat -atuvpn | egrep '(127.0.0.1|::):53 .*' | egrep -v ESTABLISHED
      should list named is listening on port 53 for tcp, tcp6, udp and udp6.
  3. If the system can access the outside world, dns queries against the server at localhost should work
    • host www.ubuntu.com localhost
    • host -T www.ubuntu.com localhost
    • host -6 www.ubuntu.com localhost
    • host -T -6 www.ubuntu.com localhost

LAMP

Case ID: ec2-009

[TBC] Create a user data script that installs and runs a LAMP stack

  1. Test Apache:

    • Execute

      w3m http://127.0.0.1/
      in a terminal and verify that it's not a 404 error page.
  2. Test MySQL

    • Execute

      mysql -u root -p

      in a terminal. You should then be presented with a mysql prompt mysql>  where you can enter mysql commands. Some commands you can use to verify the installation are show databases;, connect mysql;, show tables;, and select * from user;:

      • show databases; connect mysql; show tables; select * from user;

Mail server

Case ID: ec2-010

[TBC] Create a user data script that installs and runs Postfix mail server

  1. Confirm that postfix is running:
    • telnet 127.0.0.1 25
      should connect to postfix. Type "quit" to disconnect.
  2. Confirm that dovecot pop3 and imap servers are running:
    • sudo netstat -ltnp | grep dovecot
      should list 4 dovecot instances (port 110, 143, 993 and 995).
  3. Send a test email:
    • echo foo | mail -s 'test' ${USER} 
    • Start

      mutt
      - the test email should be in the inbox.

Openssh server

Case ID: ec2-011

[TBC] Create a user data script that installs and runs Openssh

  1. Confirm that sshd is running:
    • pgrep sshd
      should return the pid of sshd.
    • If you can, try to connect to the server from a remote client.

PostgreSQL Database Server

Case ID: ec2-012

[TBC] Create a user data script that installs and runs PostgreSQL Database Server

  1. Check that the database is running:
    sudo -u postgres psql -l
    should return a list of databases.
  2. Create a database user:
    • sudo -u postgres createuser -DRS ${USER} 
      should create a user.
  3. Create a database:
    • sudo -u postgres createdb -O ${USER} ${USER}_db
      should create a database.
  4. Connect to the database:
    • psql ${USER}_db
      should start a psql shell connected to the database.

Case ID: ec2-013

[TBC] Create a user data script that installs and runs CUPS print server

  1. Test cups:

    • sudo /etc/init.d/cups status
      should state the cupsd is running.

Samba server

Case ID: ec2-014

[TBC] Create a user data script that installs and runs Samba server

  1. Confirm that samba is running:
    • pgrep smbd, pgrep nmbd, pgrep winbindd should return the pid of the different processes:

      pgrep smbd; pgrep nmbd; pgrep winbindd

Tomcat server

Case ID: ec2-015

[TBC] Create a user data script that installs and runs Tomcat

  1. Confirm that Tomcat is running:
    • sudo netstat -ltnp | grep jsvc
      should show a jsvc instance listening on port 8080.
  2. Confirm that Tomcat is working properly:
    • w3m http://127.0.0.1:8080
      should bring up a "It works !" page
    •  w3m http://localhost:8080/examples/servlets/servlet/HelloWorldExample
      should bring up a "Hello World!" page.
    •  w3m http://localhost:8080/examples/jsp/jsp2/el/basic-arithmetic.jsp
      should bring a page containing basic arithmetics.

NB: w3m basics: moving cursor and hit <Enter> to follow links, <B> to come back to the previous page, <q> to quit