Change email with AWS Cognito and Amplify

Introduction

When trying to integrate with Amplify (AWS managed authentication service), I came accross a bug with change email, its been around for years and it's yet to be fixed (https://github.com/aws-amplify/amplify-js/issues/987).

I managed to get around this by using two lambda functions so I thought I would post a rough example here.

Note all the code is just for example purposes.

The React Component

The Serverless Configuration

The 'Change Email' Lambda

The 'Change Email Confirm' Lambda