AWS Amplify Release, GraphQL, and Recent Curated Links

This release kicked off this week in time for re:Invent and I put together a quick write up. Any questions, feel free to ping me via my contact form or better yet, just pop a question at me via the Twitters @Adron.

Authenticator

Amplify’s new Authenticator

Docs here

The new authenticator is a component that adds a full authentication flow for your app with coordinated boilerplate. This covers vue.js, angular, and react frameworks. The component has a customizable UI (as you’d expect), includes social logins for Google, Facebook, Apple, and Amazon. The initial setup is zero-configuration, and does have password manager support, along with show/hide confirm password forms.

The zero configuration works based on your Amplify CLI setup. To use this component grab the latest version of Amplify 6.4.0.

npm

npm install -g @aws-amplify/cli@latest

yarn

yarn global add @aws-amplify/cli@latest

Once that runs it will update your aws-exports.js with the latest backend configuration for the Authenticator. So, zero configuration you have to add, but there’s configuration back there if you need to or want to dig in.

There is then an initial state for the component that sets a user up for sign in, sign up, or resetting their password. You might start with some code to get the component in your page like this.

export default function App() {
  return (
    <Authenticator>
      {({ signOut, user }) => (
        <main>
          <h1>Hello {user.username}</h1>
          <button onClick={signOut}>Sign out</button>
        </main>
      )}
    </Authenticator>
  );
}

Then to set the initial state add the following parameter.

export default function App() {
  return (
    <Authenticator initialState="signUp">
      {({ signOut, user }) => (
        <main>
          <h1>Hello {user.username}</h1>
          <button onClick={signOut}>Sign out</button>
        </main>
      )}
    </Authenticator>
  );
}

Setting many of the other options to your needs includes adding additional parameters to the Authenticator component like;

Social providers

export default function App() {
  return (
    <Authenticator socialProviders={['amazon', 'apple', 'facebook', 'google']}>
      {({ signOut, user }) => (
        <main>
          <h1>Hello {user.username}</h1>
          <button onClick={signOut}>Sign out</button>
        </main>
      )}
    </Authenticator>
  );
}

Sign up attributes

export default function App() {
  return (
    <Authenticator signUpAttributes={[]}>
      {({ signOut, user }) => (
        <main>
          <h1>Hello {user.username}</h1>
          <button onClick={signOut}>Sign out</button>
        </main>
      )}
    </Authenticator>
  );
}

Login mechanisms

export default function App() {
  return (
    <Authenticator loginMechanisms={['username']}>
      {({ signOut, user }) => (
        <main>
          <h1>Hello {user.username}</h1>
          <button onClick={signOut}>Sign out</button>
        </main>
      )}
    </Authenticator>
  );
}

There are lots of other features too, give the docs a quick read for the full details. For more details on the overall authentication worflow check out these docs.

In-App Messaging

In App Messaging

This library is, sadly for my vue.js app, only available for react native. A quick install will get you started.

npm install -E aws-amplify@in-app-messaging aws-amplify-react-native@in-app-messaging amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage @react-native-picker/picker react-native-get-random-values react-native-url-polyfill

Then install pod dependencies for iOS.

pod install

An example looks like this.

import 'react-native-get-random-values';
import 'react-native-url-polyfill/auto';

import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';

AppRegistry.registerComponent(appName, () => App);

Then import the awsconfig vis aws.exports.js.

import Amplify from 'aws-amplify';
import awsconfig from './src/aws-exports';

Amplify.configure(awsconfig);

Then integrate the Amplify React Native UI component if your app’s root component.

import {
  InAppMessagingProvider,
  InAppMessageDisplay
} from 'aws-amplify-react-native';

const App = () => (
  <InAppMessagingProvider>
    {/* Your application */}
    <InAppMessageDisplay />
  </InAppMessagingProvider>
);

re: from the docs, here’s an app.jsx example.

import React, { useEffect } from 'react';
import { SafeAreaView, Button } from 'react-native';
import { Analytics, Notifications } from 'aws-amplify';
import {
  InAppMessagingProvider,
  InAppMessageDisplay
} from 'aws-amplify-react-native';

const { InAppMessaging } = Notifications;

// To display your in-app message, make sure this event name matches one you created
// in an In-App Messaging campaign!
const myFirstEvent = { name: 'my_first_event' };

const App = () => {
  useEffect(() => {
    // Messages from your campaigns need to be synced from the backend before they
    // can be displayed. You can trigger this anywhere in your app. Here we are
    // syncing just once when this component (your app) renders for the first time.
    InAppMessaging.syncMessages();
  }, []);

  return (
    <SafeAreaView>
      <InAppMessagingProvider>
        {/* This button has an example of an analytics event triggering the in-app message. */}
        <Button
          onPress={() => {
            Analytics.record(myFirstEvent);
          }}
          title="Record Analytics Event"
        />

        {/* This button has an example of an In-app Messaging event triggering the in-app message.*/}
        <Button
          onPress={() => {
            InAppMessaging.dispatchEvent(myFirstEvent);
          }}
          title="Send In-App Messaging Event"
        />

        <InAppMessageDisplay />
      </InAppMessagingProvider>
    </SafeAreaView>
  );
};

export default App;
In App Messaging

Custom Resources w/ AWS CDK or Cloudformation

René (@renebrandel) wrote a blog post on extending the Amplify backend with custom AWS resources using AWS CDK or CloudFormation. The post is avilable here but I’ll give you a quick summary.

The new CLI comand amplify add custom will get almost any of the AWS services added to an Amplify backend. The core tech here is backed with AWS Cloud Development Kit (CDK) or CloudFormation. For example if you want to pull in AWS SNS as custom resource, this is a very quick and concise way to do just that.

Again, check out René’s post to really get into it and check out some of the possibilities.

Overriding Amplify Backend Resources with CDK

Amplify sets up various capabilities out of the box in many situations such as project-level IAM roles, Cognito Auth, or S3 resources. As with the previous section, this one I’ll keep short as René (@renebrandel) has wrote a great blog post about this capability too titled “Override Amplify-generated backend resources using CDK“. If you’re interesting in nixing (overriding) any of these features and using another choice, this is your go to.

Prototype a Fullstack App without an AWS Account

Not specifically related to the release, this capability that Christian Nwamba AKA Codebeast wrote up in a blog post will show you how to do just that. The docs focused around what he details in the post are avilable here.

GraphQL Transformer v2

This I saved for last, it’s in my wheelhouse after all. Some of the features of the new v2 drop include; deny-by-default auth, lambda authorizer, customizable pipeline resolvers, and OpenSearch aggregations and use-scoped queries. The accomplished blogger, as mentioned in this very blog post, blogging legend René continues with “AWS Amplify announces the new GraphQL Transformer v2. More feature-rich, flexible, and extensible.“.

The first thing René brings up in the post is more explicit data modeling. I’ve stolen two of the screen shots from that post as examples and motivation to click through and check out the post. But I’ll also elaborate.

Adding primary and secondary indexes.

With the new explicit data modeling options, we’ve got @primaryKey and @index added as directoves to configure primary and secondary indexes from schema for your Dynamo Database. The directives in AppSync GraphQL really makes for a powerful schema definition capability to push via code first or to map from database to GraphQL scehma.

Adding relational directives.

The other part that is hugely important is the ability in schema to draw relationships that add referential integrity to your schema and the inherent data. There are now @hasOne, @hasMany, @belongsTo, and @manyToMany directives. I’m really looking forward to some data schema and modeling build outs in the near future. I’ll be sure to put together some tutorials and content detailing some of the design considerations and where and how to get all the schema hacks working best for your particular app data builds.

Thanks & Curated Follows

That’s it for this post. I’m always endeavoring to bring interesting tech and blog about it, but another way to get the quickest updates, links, details, and information about these releases is to follow the following people in the Twittersphere. They’re all in the cohort I run with at AWS with the Amplify team. I owe thanks to each for helping me find the following information and details included in this blog entry.

TRIP REPORT: O’Reilly Velocity & Software Architecture Conf 2019

This past week the O’Reilly Velocity and Software Architecture Conferences took place. I’ve attended both before, the 2nd time for Velocity in San Jose and the 2nd time for Software Architecture, however this time in San Jose and the last I attended was in London. The locations for these conferences dictate much about what is presented and how conversations, meeting and interacting, learning, and explorations take place during the conference, but more on those specifics in a moment.

The overarching theme from keynotes and many of the conversations I had met on a few key topics:

  1. When you’re building software, and you want to do it well you first and foremost must, absolutely must, invest in the people building your software.
  2. Focus on simplicity, remove complexity at every opportunity.
  3. Organizational structure can have direct impact in the complexity or simplicity of software, structure your organization efficiently and make every effort to keep it simple.

TLDR; Keep your people happy, focus on simplicity, minimize organizational noise from bureaucracy.

Topically Elaborating on Edge and Serverless

Ok, so a number of conversations came up around edge computing and serverless. Both interesting, but it also seems like there isn’t a strong play for the Enterprise is either space just yet. At this point however, a lot of enterprises are struggling with their Kubernetes, Cloud, and Hybrid solutions enough as it is that they haven’t even broached the edge compute and serverless realm. But that hasn’t stopped a lot of forward thinking individuals to start tackling how to cut out a useful spectrum of application with both edge and serverless.

Serverless Oh My!

Serverless, like so many other names, is kind of a garbage name at first. It effectively tells us nothing useful. It’s a word that requires more words just to give it meaning. It’s kind of like if I said “I like food!” What does this even mean? So, everybody eats food and most people like it, so what does “I like food!” actually mean? Same with serverless, because the first thing it doesn’t mean is a system that has no servers. What it generally means is something about your applications and you not doing anything with servers. It’s the mythic NoOps by simply removing the computers somehow.

Serverless, or simply code that executes via compute, and you get a result, has actually been around for some time. There were a number of startups that were well ahead of AWS Lambda and the other respective implementations that Azure and GCP have. These startups had been attempting to usher in what it took AWS’s massiveness and clout to actually get people to pay attention to. Serverless however has gone far beyond merely Lambda at AWS and now we’ve got to contend not only with the option in the existing cloud providers but where, how, and when can we get it into our data centers! The TLDR is that enterprise wants serverless and they’re interested in throwing it onto Kubernetes or whatever they’ve got. But often the infrastructure and systems to really make use of this simply isn’t there.

Most of the conversations I had evolved around the who, what, where, when, and how do we make use of these options for what we do? This is where most companies, at least enterprise and large companies, currently seem to be in the market. Then there are the companies that have already made the leap and are doing all sorts of stuff with Lambda and related serverless offerings. The gulf, that middle ground, doesn’t seem to have been broached by many others. Everybody, anecdotally of course, seems to be either trying to figure out how to start or already made the leap!

Edge Compute

This kept coming up, regardless of how or what people defined it as, it came up as something a number of people were very interested in. This notion, loosely based around using edge devices; smart phones, IoT devices, your car, or your washer for example, it could be almost anything. These devices do compute on the edge and thus the term. However it’s interesting because it isn’t like, for example, cloud computing that has core features like compute, storage, and related elements. Edge computing can run the gamut of any device doing any kind of work and the related capabilities of that device. It kind of leaves the space wide open. However, there were a few focal points that kept coming up.

The most common topic that came up around edge computing was doing tasks at point of presence. Such as having a phone do facial recognition, computing path finding (i.e. traffic directions), and related compute on the device versus round tripping it back to the cloud. It almost seems like after all these years of pushing things to the server we’re really starting in earnest to bring smart processes and tasks back to the devices we have in hand – no pun intended. It’s an interesting space, interesting paradigms, and I’m still not ready to call a specific thing within the world of edge compute and say, “that’s the next billion dollar idea”. Largely because, there are a lot of billion dollar ideas out there these days.

Speaking of edge compute and serverless, my fellow DataStaxian also had a few of these conversations on said topics. Patrick wrote up a post on a few observations over on the DataStax blog “Velocity Conference Shows What’s Gaining Velocity in Data Management“.

Geographic Location

As I mentioned, this set of conferences is in San Jose, the home of Silicon Valley, but the southern segment of the area. It’s a walk-able area with a number of places to break out from the conference and really dig into the hallway tracks (i.e. impromptu conversations!) that come up. For those willing to jump on the light rail, or scooter around, San Jose opens up even more to the local area providing a wide variety of coffee, food, and other operations to share conversations over.

All in all, the geographic location for the event is solid, being in the center of the city where it is. However one issue did arise, the Marriott lost power as an electrical fire in the control room of the multi-story hotel blew out the power. At last I checked upon leaving, it still didn’t have power! With the temperature at 105f going on multiple days at this point, the hotel because extremely hot inside, and being a kind of sealed airspace the air calculators also weren’t refreshing the air. That left a number of guests in less than stellar condition to attend, let alone attain value, from the conference events. Myself I ended up checking out in short order, getting sick the last day of the conference anyway, and being unable to provide the presentation that I had paired up with Lena (@lenadroid) for! I’ve been thinking, that maybe she and I can provide an online version of it for those that had wanted to hear us present on “Flexible Cloud Architectures: Decision Making Best Practices“.

Next year’s Velocity looks like it’ll be in Santa Clara, which doesn’t really excite me as it’s kind of a nebula of sprawling suburbia of boredom. This is were location becomes fundamental to what will or what can be the potential of secondary and tertiary conversations at a conference like this. Don’t get me wrong, the hallway track is excellent, but having options to step out and walk across the street from the event to converse further adds a tremendous value.

Santa Clara simply doesn’t do that unfortunately.

The fortunate thing between now and then, albeit the conference is moving to Santa Clara, they’re having subsequent conferences in the Velocity series in Berlin, and Software Architecture Conf series in the amazing cities of New York and Berlin. Those locations are worth traveling to for far more than a conference, increasing my interest in attending both of those future events. I’m looking forward to these!

Twitter Talk @VelocityConf

From @DataStaxDevs a thread! Click through for all ~17 parts.

Some Build Engineer Work – Click through for the whole construction thread.

Some of the Keynote Threads

Alena Hall – @lenadroid

Jessica Kerr – @jessitron

…and there were a bunch of others too, solid, check out the hash tag of #velocityconf to read up on more.

The Lagniappe

After the conference I finally managed to pick up a pocket Constitution.

If you’re ever in search of good coffee in San Jose, one place I found that’s tops is Academic Coffee, both the coffee and service are great. Good jovial crew and lots of cyclists in and out.

Making progress on the CaSMa, tweeted a bit on the topic while en route to the conference. If you’d like to get involved, please do let me know!

Other arbitrary statistics:

  • Stickers collected: 11 unique, ~7 of each. Total: 77 stickers.
  • T-shirt Swag: 2.
  • Conversations @ DataStax Booth: 11
  • Hallway Track Conversations: 7
  • Coffee Consumed: 9 over 3 days.
  • Twitter Filters Discussed: 123.
  • Fuel burned to compensate for electrical fire damage for the time of the conference: Approximately 5k gallons of fuel for the Marriott Hotel and no idea how much more fuel was or is still being burned to power the hotel.
  • Times the power still went off even with the diesel engine power trailer attached: 4.