AWS News Blog

Amazon AppStream – Deliver Streaming Applications from the Cloud

How would you like to build high-fidelity, graphically rich applications that run on a wide variety of devices, start instantly, and have access to all of the compute and storage resources of the AWS Cloud? What about giving this capability to existing applications?

That’s a tall order; fortunately, our new Amazon AppStream service is up to the task! This service hosts and runs your server-side application code on a fleet of Amazon EC2 instances. Your users run the client side of your application on the desktop or mobile device of their choice; AppStream (as the name implies) streams the output of the application to the device. The client application can be a simple, lightweight gateway or bridge that’s quick to download and requires a modest amount of local storage.

You can easily adapt existing applications to run in this new environment. You can also build new applications that take full advantage of AppStream’s unique architecture. AppStream even gives you the flexibility to stream part of your application from the cloud while running the rest of it on the client device.

We are launching a preview of this service today. You can apply for admission to this preview after you read the remainder of this post!

AppStream Benefits
AppStream lets you build complex applications that run from simple devices. Your application is not constrained by the compute power, storage, or graphical rendering capabilities of the device. Instead, it runs on our powerful new g2 instance type and can take advantage of all that the instance has to offer, including high-performance GPU-powered rendering of 2D and 3D graphics.

Because your application runs in the cloud, you can support additional device types by simply creating additional client applications. Your development investment in the core application logic, the database access, and some (possibly even all) of the user interface remains applicable, regardless of the device used to access your application. Further, your proprietary code remains in the cloud, where it is easy to update, safe from tampering, and resistant to theft.

Your application will start instantly, without the delays inherent in downloading and installing a native application. The application can respond to the keyboard, mouse, and touch screen (as appropriate). It can also respond to special hardware on the device, such as accelerometers and GPS receivers.

AppStream Architecture
Let’s dig in a bit deeper and take a look at the structure of an application that runs in AppStream. To make things simpler, when I refer to “the application” from this point forward, I’m referring to the code that runs on the server. I’ll use “client” for the code that runs on the desktop or mobile device.

The application runs in a Windows 2008 R2 environment on an EC2 instance. The client always initiates the connection; when it does so it always supplies a Session ID.

The application can make use of the native Windows APIs. It can also use AWS resources — relational and NoSQL databases, persistent object storage, caching, message queues, publish and subscribe messaging, email delivery, and much more.

AppStream Nuts and Bolts
AppStream has a set of free server APIs (names beginning with XStxServer) that the application uses to wait for connections and to render video and audio content to the server. The XStxServerManager object plays a central role here. Your application will register callback functions (“sinks”) to handle the initiation and termination of connections, requests for audio or video frames, and to process input (keyboard, mouse, touch, and so forth) data from the client.

The application is responsible for delivering frames of audio and video to AppStream on demand. AppStream supports both pushing and pulling of frames. Pushing means that the application generates new frames of its own accord, with optional management of the frame rate. Pulling means that AppStream will ask the application for frames on an as-needed basis. The application generates each video frame in YUV 420 format and hands them over to AppStream for streaming to the client device. In addition to supporting API-powered delivery of audio frames, AppStream can capture system audio output. AppStream even supports the use of timestamps to synchronize audio and video frames.

AppStream has a set of free client APIs (names beginning with XStxClient) that the client uses to interact with the server. An XStxClient object manages an individual streaming session. The client installs listeners that are tasked with handling decoding of audio and video. The client passes keyboard, mouse, and other device events to the XStxClient for delivery to the server.

The application is responsible for creating the session (more on this in a moment), decoding and displaying video and audio frames as they arrive, and relaying user input back to the application. We have provided source code for sample clients that will run on Microsoft Windows, iOS devices, Kindles, and Android tablets; you can find this source code in other places, but we have provided it here for your convenience

You, as the application architect, can decide on the balance of client and server functionality that makes the most sense for your particular application and use case.

There’s one more important issue to cover! As I noted earlier, the client initiates a session by calling AppStream with a Session ID. In most cases, you will want to ensure that the user running the client is authorized to use your application before letting him or her get a Session ID. AppStream offers an example of how you might do this in the provided sample Entitlement Service. In this model, the client sends an application identifier and the users credentials to the Entitlement Service.

The Entitlement Service verifies the credentials, determines if the user is authorized, and if so asks AppStream to entitle a session.  AppStream will generate a single-use Entitlement URL that is sent back to the client and used to fetch the Session ID and IP address of the EC2 instance that will service the session.  You can use the sample Entitlement Service included with AppStream SDK for development purposes; you will, however, want to build a service of your own for production deployment. Your Entitlement Service can be hosted on an Amazon EC2 instance or on AWS Elastic Beanstalk.

Here is the overall flow:

Getting Started with AppStream
We have created sample clients and applications and a sample Entitlement Service to help you to get started. Depending on your use case, you may be able to use these sample implementations with your application without modification. If your application requires additional functionality, you can use the sample implementations as a starting place to create your own clients.

Here are the steps that you will follow (this is all covered in the AppStream Developer Guide in considerable detail):

  1. Download and install the AppStream SDK.
  2. Build the sample client.
  3. Build the sample application.
  4. Package the server application and upload it to S3.
  5. Add the application to AppStream.
  6. Deploy the sample Entitlement Service.
  7. Start the client and connect to the application.

You can create and manage AppStream clients and server applications locally and manage them from the AWS Management Console.

Limited Preview
As I mentioned earlier, we are launching Amazon AppStream in limited preview fashion. Apply now, and we will let you in as soon as possible.

— Jeff;


Jeff Barr

Jeff Barr

Jeff Barr is Chief Evangelist for AWS. He started this blog in 2004 and has been writing posts just about non-stop ever since.