First look: AWS Mobile Hub fills the potholes
Developing mobile apps on the Amazon cloud is now significantly easier, at least for iOS and Android clients
-
Amazon AWS Mobile Hub (beta)
When I reviewed the Amazon Mobile SDK and competing products from Microsoft and Google in March, I said, “While the AWS Mobile SDK does what it sets out to do, developing with it is not for novices, JavaScript programmers, or the faint of heart.” I went on to conclude, “The AWS Mobile SDK might be a good choice for native app developers who already have a commitment to Amazon services. If you want an easy-to-learn and easy-to-use MBaaS, look elsewhere.”
Whether or not the AWS engineers heard my criticisms, they have addressed them in the new Amazon Mobile Hub, currently a beta-level service. Rather than fix items at the level of the basic services, Amazon chose to add an integration layer with (gasp!) a reasonably self-explanatory user interface.
As shown in Figure 1, the AWS Mobile Hub is organized into five top-level screens. Each screen leads to additional functionality.
Figure 1: AWS Mobile Hub introduces a helpful GUI that walks you through the steps to building your app. The Hub is organized into five top-level screens, each of which leads to additional functionality.
The Configure screen, shown in Figure 2, allows you to set up six areas of functionality for your app: user sign-in, push notifications, app content delivery, user data storage, app analytics, and cloud logic. Green check marks indicate functions that have been configured.
Figure 2: The Configure screen allows you to set up user sign-in, push notifications, app content delivery, user data storage, app analytics, and cloud logic.
For this particular sample app I have omitted push notifications because they're kind of a pain to set up. You need to go off to Apple and Google, configure the native push notification engines, then come back and add the credentials to the AWS Mobile Hub, as shown in Figure 3.
Figure 3: Amazon SNS needs your Android and iOS push notification credentials. Amazon actually does a decent job of explaining where and how to get them.
AWS Mobile Hub currently supports Facebook and custom sign-ins for your application’s users, and it will support Amazon, Google, and Twitter sign-ins in the future, as you can see in Figure 4. Mobile Hub can already generate logic for optional and required sign-ins. When the user does not sign in, the app uses Cognito to generate anonymous unauthenticated credentials.
Figure 4: The Mobile Hub will eventually support five sources of sign-in. It can already generate logic for optional and required sign-ins.
Mobile Hub can configure content delivery -- typically for images that you provide and want to be downloaded to the client on demand -- in an S3 bucket or in CloudFront, as shown in Figure 5. S3 is cheaper, but limited to a single availability zone. CloudFront gives you better performance if you have globally distributed users, but will cost you a little more when you get to scale.
Figure 5: Mobile Hub can configure content storage in an S3 bucket or in CloudFront. S3 is cheaper; CloudFront gives you better performance if you have globally distributed users.
If you allow user data storage, the Mobile Hub sets up an integrated combination of file (media and document) storage in S3 and pair storage in Cognito Sync. Access to a user’s folder in the S3 bucket is restricted to the key stored in Cognito under the user’s authenticated or unauthenticated ID. Cognito is typically employed for user profile data.If you enable App Analytics, you can see a dashboard similar to the demo in Figure 6 after your app has been in use. The dashboard is updated in batches, roughly hourly. I verified that this works for the iOS and Android sample apps.
Figure 6: If you enable App Analytics, you can see a dashboard similar to this demo after your app has been in use. The dashboard is updated in batches, roughly hourly.
Cloud logic running in Amazon Lambda gives you back-end functions that you can call from your app, as shown in Figure 7. Lambda charges you by the API call and the CPU consumed. In fact, the attractive-looking Node.js back end with RESTful API gateway that I added from the preconfigured Lambda blueprint menu did not “stick” when I generated the app. That appears to be a beta bug, unless I omitted a step when I did the configuration.
Figure 7: Cloud logic running in Amazon Lambda gives you back-end functions that you can call from your app. Lambda charges you by the API call and the CPU consumed.
If your app has a Web view, you might want to populate it from an Express instance. Or you might want to send HTTP(S) requests to your existing mobile-friendly website, which can be running anywhere.
The Mobile Hub can generate native code for a sample app in Objective-C for iOS and Java for Android. The code didn’t compile in Xcode 6.4, but built fine in Xcode 7.0.1 and Xcode 7.1 beta 3, as we can see in Figure 8. The sample app already has the correct Amazon IDs and keys inserted into its constants.
Figure 8: The Amazon Mobile Hub sample app, written in Objective-C, already has the correct Amazon IDs and keys inserted into its constants. The code requires Xcode 7.0 or later to build without errors.
Figure 9: The home screen of the iOS demo app. The colors in this image are yellow on black because I selected that preference in the key/value pair portion of the demo.
The home screen of the iOS demo app, shown in Figure 9, is a list with icons and text. Selecting an item slides in the panel that demonstrates the appropriate feature. The colors in this image are yellow on black because I selected that preference in the key/value pair portion of the demo.
The native Android app generated by the Mobile Hub, in Java, has all the same features as the iOS app, but presents an Android look and feel. The orange background in the header in Figure 10 is the default color scheme. While I previously set a preference for different colors in the iOS app, I wasn’t logged in, so the Android user can’t see the iOS user’s preferences or data. This behavior is correct.
Figure 10: The native Android app generated by the Mobile Hub has all the same features as the iOS app, but presents an Android look and feel. The orange background in the header is the default color scheme.
In general, I think the Amazon Mobile Hub beta is shaping up nicely. There are a few unimplemented features and a few probable bugs, but overall the Mobile Hub makes it much easier to assemble native iOS and Android apps that rely on Amazon back-end services. It’s a big step forward.
Copyright © 2015 IDG Communications, Inc.