Skip to content

Using euca2ools on lxplus-cloud

These steps describe how to create your environment using the Amazon EC2 compatible commands from the euca2ools suite.

Obtaining the EC2 zip profile

The euca2ools require a set of shell environment variables in order to run. These variables can be obtained and stored in an 'rc' file much like .profile when logging into a linux server. The environment variables are different per project that you work on.

The profile can be selected through the CERN Cloud dashboard.

  • Select the 'API Access' tab
  • Drop-down menu 'Download OPENSTACK RC FILE' on the right hand side allows you to download the EC2 credentials

This will download a file called Personal-my-user-name-x509.zip. You should then transfer this to your lxplus account using a tool like scp or via AFS.

Unzip the EC2 key zip file

On lxplus-cloud, you can unpack the zip file to create the appropriate key files and the profile ec2rc.sh.

$ unzip "Personal my-user-name-x509.zip"
Archive:  Personal my-user-name-x509.zip
 extracting: ec2rc.sh

Testing the credentials

The images can be listed using euca-describe-images.

$ . ec2rc.sh
$ euca-describe-images
IMAGE   ami-614d1dbe    None (CC7 - x86_64 [2018-12-03])    8e35e961-f888-4622-bf7d-5fe9eb8cf563    available   public      x86_64  machine             instance-store
IMAGE   ami-488fd080    None (CernVM 4 - Bootloader v2018.10-1 [2018-11-15])    0f1e3a18-dbf0-489f-9731-ed873445789d    available   public          machine             instance-store
IMAGE   ami-0d034ff8    None (CernVM 3 - Bootloader v2018.10-1 [2018-11-15])    0f1e3a18-dbf0-489f-9731-ed873445789d    available   public          machine             instance-store
IMAGE   ami-832a2f09    None (Windows 2016 Standard)    7380e730-d36c-44dc-aa87-a2522ac5345d    available   public      x86_64  machine             instance-store
IMAGE   ami-cf316b48    None (Windows 2012 Standard R2) 7380e730-d36c-44dc-aa87-a2522ac5345d    available   public      x86_64  machine             instance-store
IMAGE   ami-3feb7f0b    None (Windows 2008 Enterprise R2)   7380e730-d36c-44dc-aa87-a2522ac5345d    available   public      x86_64  machine             instance-store

Using euca2ools on Ubuntu

These steps describe how to create your environment with EC2 access keys.

Create your environment using EC2 access keys

Ubuntu ships with a recent euca2ools version 3.x.x (Omega) that supports access keys. You can obtain your EC2 access keys using the openstack client:

$ openstack ec2 credentials list
+----------------------------------+----------------------------------+--------------------------------------+--------------+
| Access                           | Secret                           | Project ID                           | User ID      |
+----------------------------------+----------------------------------+--------------------------------------+--------------+
| jhsd884b2234tsdftsuejsdfhtsgd932 | 90832495jsdfasdfawe5g3935ismdf89 | e4611b65-2743-4a7f-ad08-585231e32d34 | my-user-name |
+----------------------------------+----------------------------------+--------------------------------------+--------------+

If you have more projects select the access/secret keys for the project that you want to use.

Setup the necessary environment variables:

export EC2_URL=https://openstack.cern.ch:8772/services/Cloud
export AWS_ACCESS_KEY=jhsd884b2234tsdftsuejsdfhtsgd932
export AWS_SECRET_KEY=90832495jsdfasdfawe5g3935ismdf89

Testing the credentials

$ euca-describe-images
IMAGE   ami-614d1dbe    None (CC7 - x86_64 [2018-12-03])    8e35e961-f888-4622-bf7d-5fe9eb8cf563    available   public      x86_64  machine             instance-store
IMAGE   ami-488fd080    None (CernVM 4 - Bootloader v2018.10-1 [2018-11-15])    0f1e3a18-dbf0-489f-9731-ed873445789d    available   public          machine             instance-store
IMAGE   ami-0d034ff8    None (CernVM 3 - Bootloader v2018.10-1 [2018-11-15])    0f1e3a18-dbf0-489f-9731-ed873445789d    available   public          machine             instance-store
IMAGE   ami-832a2f09    None (Windows 2016 Standard)    7380e730-d36c-44dc-aa87-a2522ac5345d    available   public      x86_64  machine             instance-store
IMAGE   ami-cf316b48    None (Windows 2012 Standard R2) 7380e730-d36c-44dc-aa87-a2522ac5345d    available   public      x86_64  machine             instance-store
IMAGE   ami-3feb7f0b    None (Windows 2008 Enterprise R2)   7380e730-d36c-44dc-aa87-a2522ac5345d    available   public      x86_64  machine             instance-store

Using AWS cli

These steps describe how to create your environment for the AWS client.

Create your environment for the AWS cli

Install AWS cli. On CentOS 7:

# yum install awscli -y

Obtain your EC2 access keys using the openstack client:

$ openstack ec2 credentials list
+----------------------------------+----------------------------------+--------------------------------------+----------+
| Access                           | Secret                           | Project ID                           | User ID  |
+----------------------------------+----------------------------------+--------------------------------------+----------+
| jhsd884b2234tsdftsuejsdfhtsgd932 | 90832495jsdfasdfawe5g3935ismdf89 | e4611b65-2743-4a7f-ad08-585231e32d34 | timbell  |
+----------------------------------+----------------------------------+--------------------------------------+----------+

Create the configuration file for AWS cli in your home directory ~/.aws/config with the ec2 credentials and endpoint:

[default]
aws_access_key_id = jhsd884b2234tsdftsuejsdfhtsgd932
aws_secret_access_key = 90832495jsdfasdfawe5g3935ismdf89
region = cern

Testing the credentials

$ aws --endpoint-url https://openstack.cern.ch:8772 ec2 describe-images --output text --no-verify-ssl
/usr/lib/fence-agents/bundled/botocore/vendored/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
IMAGES  x86_64  2020-11-20T14:33:29Z    ami-e135c92a    None (CC7 - x86_64 [2020-11-20])    machine CC7 - x86_64 [2020-11-20]   8e35e961-f888-4622-bf7d-5fe9eb8cf563    True    instance-store  available
IMAGES  x86_64  2020-11-02T13:59:52Z    ami-3c39accf    None (C8 TEST - x86_64 [2020-11-02])    machine C8 TEST - x86_64 [2020-11-02]   8e35e961-f888-4622-bf7d-5fe9eb8cf563    True    instance-store  available
IMAGES  x86_64  2020-10-01T07:41:34Z    ami-2a1cae55    None (C8 - x86_64 [2020-10-01]) machine C8 - x86_64 [2020-10-01]    8e35e961-f888-4622-bf7d-5fe9eb8cf563    True    instance-store  available
IMAGES      2020-04-09T14:30:28Z    ami-8b92522a    None (CernVM 4 - Bootloader v2020.04-1 [2020-04-09])    machine CernVM 4 - Bootloader v2020.04-1 [2020-04-09]   0f1e3a18-dbf0-489f-9731-ed873445789d    True    instance-store  available
IMAGES      2020-04-09T14:27:49Z    ami-076c78d6    None (CernVM 3 - Bootloader v2020-04-1 [2020-04-09])    machine CernVM 3 - Bootloader v2020-04-1 [2020-04-09]   0f1e3a18-dbf0-489f-9731-ed873445789d    True    instance-store  available
IMAGES  x86_64  2019-04-10T13:43:12Z    ami-3f2a8537    None (Windows 10 LTSC (locally managed only))   machine Windows 10 LTSC (locally managed only)  7380e730-d36c-44dc-aa87-a2522ac5345d    True    instance-store  available
IMAGES  x86_64  2019-01-29T09:06:45Z    ami-72cd523a    None (Windows 2019 Standard)    machine Windows 2019 Standard   7380e730-d36c-44dc-aa87-a2522ac5345d    True    instance-store  available
IMAGES  x86_64  2018-10-02T14:20:57Z    ami-5e5da67f    None (Windows 10 Professional)  machine Windows 10 Professional 7380e730-d36c-44dc-aa87-a2522ac5345d    True    instance-store  available
IMAGES  x86_64  2018-01-23T08:49:14Z    ami-832a2f09    None (Windows 2016 Standard)    machine Windows 2016 Standard   7380e730-d36c-44dc-aa87-a2522ac5345d    True    instance-store  available
IMAGES  x86_64  2018-01-23T08:45:39Z    ami-cf316b48    None (Windows 2012 Standard R2) machine Windows 2012 Standard R2    7380e730-d36c-44dc-aa87-a2522ac5345d    True    instance-store  available