Skip to Content

Amazon EC2 Learnings

To get started using Amazon’s EC2 and S3 (simple storage service) service, check out two excellent blogs by Thorsten Franz and Martin English that cover the SAP system installation and EC2 configuration in great detail.

New Storage – Elastic Block Storage (EBS)

  Amazon started with S3 but added EBS some time ago. See Chris Kernaghan’s blog about EBS based images for a more detailed description.  EBS based AMIs, for example, have 30GB of root storage vs. 10GB under the old system. Futhermore, EBS based volumes attached to an instance remain available (even after terminating your instance), keeping any changes you made thus allowing you to reattach the volume the next time the image is started. 

  Doing some research, I read that you can change the size of the boot disk that an AMI starts up with. I found this intriguing since that would allow me to make the C:\ drive large enough to contain a standard CE 7.2 installation without needing a separate D:\ volume. I realize that for larger systems separate volumes for the DB and swap files are recommended but this was a small workshop instance so simplicity trumped performance and flexibility. A single drive would also make AMI and snapshot management easier. Furthermore, by having a single drive based AMI I will not have to worry about what availability zone (US-EAST has zones ‘a’ through ‘d’ ) my ‘D:\’ volume is in – both the AMI instance and volume must be in the same availability zone.

Eager to try this, I searched for a quite a while in the AWS GUI console for this functionality. No luck. It turns out I would have to install and use the command line tools to do this – thus started phase two of my EC2 experience.

Setting up the command line tools

 First step was to download the API command line tools and getting the proper JDK (1.6) installed. I stored all my files in the the ‘C:\aws’ folder. Next, create a batch file (i.e. aws_env.bat) to setup the environment. You will also need the private key and certificate you received when you signed up for Amazon AWS service. Here’s my batch file:

set Path=C:\aws\jdk1.6.0_18;%Path%
set JAVA_HOME=C:\aws\jdk1.6.0_18
set EC2_HOME=C:\aws\ec2
set PATH=%PATH%;%EC2_HOME%\bin
REM Paths to the primary key and certificate from Amazon
set EC2_PRIVATE_KEY=%EC2_HOME%\cert\pk-aws.pem
set EC2_CERT=%EC2_HOME%\cert\cert-aws.pem

After you have created the batch file and executed it you can perform a quick ‘smoke test’ to ensure your environment is configured properly by executing the command ec2-describe-regions. Your output should look something like this.


Starting an AMI

In order to start AMIs and retrieve the initial Administrator password you have to create a keypair. This is easily done using the ec2-add-keypair command. Notice that the name of the keypair does not have a dot extension. Copy the text, including the ‘Begin…’ and ‘End…’ lines into a text file named the same as your keypair. If you followed the DOS environment setup above, put that file into the ‘cert’ directory.

C:\aws\ec2\ec2-add-keypair mykeypair_test


Next, after having browsed the available AMIs using the graphical AWS console, start the AMI of your choice and increase the boot disk size to 100GB. Don’t forget to specify the keypair you created earlier. Side note: If you don’t specify the keypair your instance will still start but you will be unable to retrieve the administrator password, don’t ask me how i I know. Take note of the instance ID that the command returns, you will need that ID for subsequent commands when referring to your instance. Note: The AMI i used for this example is Windows Server 2008 64bit based machine image.

C:\aws\ec2>ec2-run-instances ami-45c22e2c -b “/dev/sda1=:100” -k mykeypair_test


Periodically, get the output from the console to see when the system is ready using the ec2-get-console-output command with your instance ID as the parameter.

Next, get the Administrator password by issuing the ec2-get-password command, specifying the keypair you used to start the instance.

C:\aws\ec2>ec2-get-password i-1ff36074 -k c:\aws\ec2\cert\mykeypair_test 


Windows Configuration

At this point, you are ready to logon on to your instance using remote desktop to perform the last step before you can use your new instance.

Open the Computer Management application in the Administrator Tools folder. Navigate to the ‘Disk Management’ section on the left and you should see something like the screen shot below. image

Although we specified a 100GB startup disk, only the default 30GB are initialized. No problem, simply right click on the disk and select ‘Extend Volume’ and shortly afterwards your ‘Disk 0’ should look like this.




   IE lock-down. Amazon has IE locked down so tight it’s basically useless. First thing to do is download Firefox, mostly for the S3Fox Organizer plugin. This is easier said then done. First, we need to change some IE preferences (Tools->Options->Security), click on ‘Custom Level’. Under the ‘Downloads’ section, enable ‘Automatic prompting for file downloads’ as well as ‘File downloads’. This will allow you to download items, namely the Firefox installer.




  When starting an AMI instance you can use a ‘spot request’ (think of it as demand based pricing) or the normal way. Spot pricing is usually significantly cheaper but has the drawback that you cannot ‘pause’ your running instance. The capability to suspend a running instance, stopping the billing clock but preserving all the work you have done, is another benefit of the EBS base images.

If you are just the least bit curious and interested in test driving AWS I encourage you to sign up. Charges are very reasonable and it’s great fun learning something new that is quickly changing the IT landscape. 

You must be Logged on to comment or reply to a post.
  • Oliver,
        Something to bear in mind for people who are Hi using AWS for parallel testing or regression testing...

    * You can NOT have multiple instances of an EBS based AMI running at the same time,
    * You can NOT take a snapshot of an EBS based AMI - In other words, there is no backup of your image

    As usual, its horses for course - being able to have more than 10GB in your 'root' disk is a worthwhile trade-off in many cases !!

    At the moment, I'm doing my work with S3 based instances, both to enable duplicate instances and to allow for reversion of the image.

    • Also, I forgot to add, another person who has quite a few blogs on using Amazon Web Services and SAP is Chris Kernaghan - /people/chris.kernaghan/blog
    • Hi Martin,
        Thanks for your comment :-). I haven't had a chance to test this but when I request a new instance for an EBS based AMI the AWS console gives me the option to specify the number of instances to launch. Will test that later.
        Good point about the snapshot, but I can create a new image and have an new AMI which preserves my changes. Tradeoffs indeed.


    • Hi Martin,

        Did a quick test, started three instances based on the same AMI(EBS). Seemed to work ok. I was able to connect to each of them via remote desktop.


  • ...I have the NW Subscription running on EC2 with dual stack setup on NW7 EHP1 SP6 and everything works great...but...somehow my Windows 2003 is loosing the shares and the page file setup after I start instance from AMI.
    I can only start SAP and EP after I create the shares again, provide authorizations and set the page file correctly.
    Have you experienced anything like that?

    🙂 Harald

    • Hi Harald,
        Interesting. No, I have not come across this. Have you enabled automatic volume mapping in the 'Ec2ConfigService Setting' program and specified the drives for your volumes?