24.2 AWS Setup
***********Mirror of earlier section in installation section?*********************
The following are Mike’s rough notes from a first attempt to port the PEcAn VM to the AWS. This was done on a Mac
These notes are based on following the instructions here
24.2.1 Convert PEcAn VM
AWS allows upload of files as VMDK but the default PEcAn VM is in OVA format
If you haven’t done so already, download the PEcAn VM
Split the OVA file into OVF and VMDK files
tar xf <ovafile>
24.2.2 Set up an account on AWS
After you have an account you need to set up a user and save your access key and secret key
In my case I created a user named ‘carya’
Note: the key that ended up working had to be made at https://console.aws.amazon.com/iam/home#security_credential, not the link above.
24.2.3 Install EC2 command line tools
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
sudo mkdir /usr/local/ec2
sudo unzip ec2-api-tools.zip -d /usr/local/ec2
If need be, download and install JDK
export JAVA_HOME=$(/usr/libexec/java_home)
export EC2_HOME=/usr/local/ec2/ec2-api-tools-<version>
export PATH=$PATH:$EC2_HOME/bin
Then set your user credentials as environment variables:
export AWS_ACCESS_KEY=xxxxxxxxxxxxxx
export AWS_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxx
Note: you may want to add all the variables set in the above EXPORT commands above into your .bashrc or equivalent.
24.2.4 Create an AWS S3 ‘bucket’ to upload VM to
Go to https://console.aws.amazon.com/s3 and click “Create Bucket”
In my case I named the bucket ‘pecan’
24.2.5 Upload
In the code below, make sure to change the PEcAn version, the name of the bucket, and the name of the region. Make sure that the PEcAn version matches the one you downloaded.
Also, you may want to choose a considerably larger instance type. The one chosen below is that corresponding to the AWS Free Tier
ec2-import-instance PEcAn_1.2.6-disk1.vmdk --instance-type t2.micro --format VMDK --architecture x86_64 --platform Linux --bucket pecan --region us-east-1 --owner-akid $AWS_ACCESS_KEY --owner-sak $AWS_SECRET_KEY
Make sure to note the ID of the image since you’ll need it to check the VM status. Once the image is uploaded it will take a while (typically about an hour) for Amazon to convert the image to one it can run. You can check on this progress by running
ec2-describe-conversion-tasks <image.ID>
24.2.6 Configuring the VM
On the EC2 management webpage, https://console.aws.amazon.com/ec2, if you select Instances on the left hand side (LHS) you should be able to see your new PEcAn image as an option under Launch Instance.
Before launching, you will want to update the firewall to open up additional ports that PEcAn needs – specifically port 80 for the webpage. Port 22 (ssh/sftp) should be open by default. Under “Security Groups” select “Inbound” then “Edit” and then add “HTTP”.
Select “Elastic IPs” on the LHS, and “Allocate New Address” in order to create a public IP for your VM.
Next, select “Network Interfaces” on the LHS and then under Actions select “Associate Addresses” then choose the Elastic IP you just created.
See also http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/GetStarted.html
24.2.7 Set up multiple instances (optional)
For info on setting up multiple instances with load balancing see: http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/gs-ec2VPC.html
Select “Load Balancers” on the LHS, click on “Create Load Balancer”, follow Wizard keeping defaults.
To be able to launch multiple VMs: Under “Instances” convert VM to an Image. When done, select Launch, enable multiple instances, and associate with the previous security group. Once running, go back to “Load Balancers” and add the instances to the load balancer. Each instance can be accessed individually by it’s own public IP, but external users should access the system more generally via the Load Balancers DNS.
24.2.8 Booting the VM
Return to “Instances” using the menu on the LHS.
To boot the VM select “Actions” then “Instance State” then “Start”. In the future, once you have the VM loaded and configured this last step is the only one you will need to repeat to turn your VM on and off.
The menu provided should specify the Public IP where the VM has launched