Using OpenFOAM with Amazon EC2® (Cloud)
The open source licensing of OpenFOAM gives users complete freedom to run the software on any platform of their choice. That includes a cloud computing service, such as Amazon Elastic Compute Cloud (EC2)® . The following quick start guide describes how to get OpenFOAM running on Amazon EC2. The instructions describe access to the service using SSH which is primarily used on Linux/UNIX systems but is also available for Windows with software such as PuTTY or Cygwin.
Sign up for Amazon EC2
The user must first sign up for the EC2 service by going to http://aws.amazon.com/ec2 and clicking Sign Up For Amazon EC2. The sign-up process first involves creating an Amazon Web Services (AWS)® account. When prompted, the user can log in with an email address and password from an existing Amazon account (e.g. for purchasing books, music, etc) or can create a new account. The website then takes the user through a process to register for AWS and subscribe to the EC2 service.
Launching an Instance
Once the subscription is completed, the user can set up a computer within the EC2 service to run OpenFOAM. AWS refers to a computer running on the EC2 service as an instance, so to use the service, the user must launch an instance. Furthermore, the system software that the instance runs is known as the Amazon Machine Image (AMI). Amazon stores public and private AMIs, each with a unique identification code, that the user can select to run with an instance they launch.
For convenience, we have created some public AMIs that run different versions of Ubuntu, OpenFOAM and other useful software. Our AMIs are listed below, each relating to Amazon hardware located in a different geographical region, e.g. eu-west-1 (Europe West). The user can select an AMI and conveniently launch an instance of it by clicking the ami-xxxxxxxx link which opens an AWS Management Console in a new terminal window. From there, the user should proceed with the following instructions.
| Ubuntu Version | OpenFOAM Version | AMI | Region |
| 10.10 Maverick | 1.7.1 | ami-8f5761fb | eu-west-1 |
Instance Details: The user is prompted in particular to select the Instance Type. The user can click the following links for descriptions and pricing of the different instance types. First time users can run the Micro instance for free, so we recommend selecting that for initial testing. Use default settings for the remainder of the Instance Details by clicking Continue until the set up process moves to…
Create Key Pair (only needs to be done the first time): Public/private key pairs allow the user to connect securely to the instance after launch. Once created for the first instance, the same key pair can be used thereafter for new instances. The user should therefore generate a key pair, with a key name such as openfoam, and save the private key to their computer. We recommend the user store the private key in a directory named .ec2 in their home directory. They can create the directory as follows
and move the downloaded private key file, openfoam.pem into that directory, e.g.
As a security measure, SSH usually requires the permissions on the private key file to be readable to the user only, e.g. by executing
Select Key Pair: Once the openfoam key pair is generated, the user should
select it from the drop down menu when creating an instance.
Create a Security Group (only needs to be done the first time): In order to allow the user to connect to the running instance via SSH, the SSH port must be opened. To set this up, the user should click the radio button for Create a new Security Group. The new group can be named “openfoam”, with description “openfoam group”. Under Create a new rule, the user should select SSH. Under Source, the user can select 0.0.0.0/0 which opens port access to everyone, which is relatively insecure. For greater security, port access can be restricted to only the user’s IP address by entering the IP address followed by /32. For example, if the user’s IP address is 123.45.67.8, enter 123.45.67.8/32.
Select a Security Group: The user should select the openfoam security group by highlighting the openfoam entry (entry like sg-xxxxxxxx - openfoam). They should then Launch the Instance when prompted.
Accessing the Running Instance
All instances can be listed by clicking the Instances link in the Navigation Panel in the AWS Management Console. The user should select their instance and, from the EC2 Instance Window (bottom of console), locate the Public DNS entry in the Description panel. It has a name with the format like ec2-xxx-xxx-xxx-xxx-<location>.compute.amazonaws.com.
In a terminal window in Linux (or Windows/Cygwin, PuTTY), execute the following command to log into the instance as user ubuntu using SSH, where the actual Public DNS (above) is substituted for AWS_PUBLIC_DNS.
To start, stop, terminate, etc a running instance, select options from the Instance Actions drop down menu. For further information, see the Amazon Web Services Documentation.
Getting Started
Create a project directory within the $HOME/OpenFOAM directory named <USER>-2.0.1 (e.g. chris-2.0.1 for user chris and OpenFOAM version 2.0.1) and create a directory named run within it, e.g. by typing:
blockMesh
icoFoam
paraFoam
Reporting Bugs in OpenFOAM
We appreciate that bugs in OpenFOAM are reported so we can fix them. Please refer to the OpenFOAM bugs pages to report bugs.