Leveraging Serverless (SAM) with Cognito Authentication

By: Morten Jensen, Nov 12 2019

Introduction

Using Serverless combined with Cognito can be a great way to eliminate the real estate as well as development and operational footprint when it comes to authentication and authorisation stacks.

Furthermore, Cognito is also likely to further enhance overall security posture when compared to in particular homebrewn alternatives.

We have put together a full demonstration Cognito application stack based on Serverless (SAM). This includes code, infrastructure as code and a Codepipeline. All ready to go (with some prerequisites).

Contents

The demonstration is a somewhat simplified implementation and demonstrates the following capabilities:

Limitations

Cognito, as with all other technologies, has a number of limitations to consider.

To workaround some of the cons consider:

Conclusion

Authentication and authorisation stacks don’t have to be daunting. We have provided a fairly comprehensive example of a Serverless Cognito stack.

Much more is possible. A couple of examples:

Feel free to raise any bugs/issues on GitHub and we will try to address them. Even better, feel free to issue pull requests (that also includes documentation).