“Converting” an Existing EC2 Instance to an Elastic GPU

For some time, I have been running an AWS EC2 G2.2xlarge instance to keep from buying a laptop to run Photoshop.  With the introduction of Elastic GPUs, I was interested in “converting” that VM to a T2.large instance with an eg1.large Elastic GPU that I believe should save me about $.40 per hour of operation.  For my use case, that may only mean a savings $6 per month but if an organization happens to be running G2.2xlarge instances that could be replaced with instances running Elastic GPUs, they could see a significant cost savings.

Now, technically speaking, I didn’t “convert” my existing instance as I was convinced that to do so would cause some kind of apocalyptic tragedy from which I wouldn’t be able to recover….remember I’m fresh off a robbery so I’m fragile.

So here’s what I did:

  1. Login to the AWS interface and shut down my G instance.
  2. I created an Amazon Machine Image (AMI) of my G instance so as to keep it intact. If you don’t know what an AMI is, think of it as a VMware VM Template.  An AMI includes information such as the operating system, updates, installed applications, etc.1-CreateAMI
  3. With the image created, I then deployed a new T2.large instance using the AMI I had just created.  On the Configure Instance Details page, select the option to Add GPU and specify the GPU type.

3-SelectEGPU

    4. You’ll need to create a new or edit an existing security group.  Personally, I created a new security group called “Elastic GPU Support”.  If the security group configuration does not match that shown below, an elastic GPU will not map to your EC2 instance.

    • Create the ingress security group rule:
    • For Type, choose Custom TCP Rule. For Protocol, choose TCP. For Port Range, enter 2007. For Source, choose Custom and enter the ID of the security group that you created in the previous step.
    • Choose Save
    • Select the security group that you just created and choose Actions, Edit outbound rules.
    • Create the egress security group rule:
    • For Type, choose Custom TCP Rule.  For Protocol, choose TCP. For Port Range, enter 0-65535. For Destination, choose Custom and enter the ID of the security group you created in the previous step.
    • Choose Save

    5. With the instance deployed from the AMI, the Elastic GPU driver must be installed.  You can find the EGPU driver here.  A reboot is required to complete the installation….you can verify the status of the Elastic GPU using the egcli command executable:

    4-DriverInstall

    6. When the instance reboots, there should be an Elastic GPU application icon within the Systray and the egcli command should return a state of “Healthy”

    5a-GPUGUI5-HealthyGPU

    7. The “conversion” to an Elastic GPU is complete….just need to test.

CONCLUSION

I am happy to say, that I’ve not had any performance issues with Photoshop/Lightroom since converting to Elastic GPUs….I even terminated my G2.2xlarge instance.

TROUBLESHOOTING

I did have a couple problems while performing this conversion:

  1. When setting up my security group, I initially failed to setup the outbound rule, thus resulting in a failure to add the Elastic GPU.  **Make sure you setup the security group to support Elastic GPUs.
  2. EG Infrastructure is not available on this instance

E1-SecurityGroupWrong

When I originally deployed the new instance from my AMI, I specified a T2.Large (maybe it was T2.xlarge) and when the instance booted, it’s acted as though it was unable to exorcise all of the G2.2xlarge demons.  I ran the egcli command to see that an EGPU was not supported on this instance type.

In theory, just because I made my AMI from a G2.2xlarge instance doesn’t mean that every instance I deploy from that AMI has to be a G2.2xlarge instance, thus, the instance type I choose shouldn’t matter.  I decided to deploy a T2.medium instance from the AMI and low and behold, everything work fine.  I then shut down the T2.medium instance, changed the instance type to a T2.large, and did not have any further issues.

E2-ChangeInstanceType

Helpful links:

http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/working-with-elastic-gpus.html

https://aws.amazon.com/blogs/aws/new-ec2-elastic-gpus-for-windows/

7 thoughts on ““Converting” an Existing EC2 Instance to an Elastic GPU

  1. Thanks a ton for this post! Very helpful!

    Good to note that if you (1) don’t shutdown the instance and create the AMI, and (2) you are connected to your instance via ssh, your connection will automatically be closed.

    Obviously to be safe I should have stopped the instance in the first place!

    It’s interesting though that while my ssh connection got closed, the instance state never stopped.

    I wonder if you can in principle make an AMI without stopping the instance…

    -josh

  2. I am having a similar program to yours…
    “EG Infrastructure is not available on this instance”.

    I have tried changing the instance state from t2.medium to t2.large to no avail.

    After installing the driver software, I do not get an icon in the system tray. I have tried redownloaidng/re-installing several times, rebooting each time.

    I can’t find any support for an issue like this from Amazon. Any thoughts?

    1. Hey kingskyloud, I assume you’ve enabled the appropriate ingress and egress rules on the security group? If you run the egcli command after doing your install, what status does it return? Was your instance always in the “t” family or did it start as something else?

    1. Hey Phil, Photoshop won’t “see” the elastic GPU so you won’t be able to use the Elastic GPU for advanced functions such as Perspective Warp. I’m hoping I am wrong on this, but to date, I’ve not been able to get Photoshop to see the Elastic GPU. Thanks for reading!

      1. What is the use then of the Elastic GPU for Photoshop & Lightroom, isn’t an instance without a Elastic GPU exactly the same?

Leave a Reply to Josh Meyer (@joshmeyerphd) Cancel reply

Your email address will not be published. Required fields are marked *