1. Home
  2. Training Library
  3. Security & Compliance (SOA-C02)

Integrating Cognito with your Mobile or Web Applications

Contents

keyboard_tab
Key Management Service (KMS)
7
What is KMS?
PREVIEW8m 25s
8
Components of KMS
PREVIEW11m 6s
AWS Web Application Firewall
AWS Shield

The course is part of this learning path

Start course
Overview
Difficulty
Beginner
Duration
5h 2m
Students
51
Ratings
3.4/5
starstarstarstar-halfstar-border
Description

This course looks at the key Security services within AWS relevant to the SysOps Administrator - Associate exam. The core to security is Identity & Access Management, commonly referred to as IAM. This service manages identities and their permissions that are able to access your AWS resources and so understanding how this service works and what you can do with it will help you to maintain a secure AWS environment.  In addition to IAM, this course covers a range of other security services covering encryption and access control

Learning Objectives

  • Learn about identity and access management on AWS including users, groups & roles, IAM policies, MFA, and cross-account access
  • Learn the fundamentals of AWS Web Application Firewall (WAF) including what it is, when to use it, how it works, and why use it
  • Learn how to manage data protection through encryption services such as the Key Management Service (KMS) and CloudHSM
  • Learn how to secure your AWS accounts using AWS Organizations
  • Understand how to configure and monitor AWS WAF, Firewall Manager, and Shield
  • Learn the fundamentals of access control via federation using AWS Cognito and AWS SSO
Transcript

Now that we know the backgrounds on both Cognito user pools and the identity pools, let's take a look at some examples of how these parts of the service work together and with your applications.

For our first example imagine we have a simple mobile / web game that allows you to store your high scores after completing a session. 

In order to save that data, however, we need to have sign up, log in, and authentication working.

Your application will need to integrate with Cognito by using the Cognito SDKs and libraries. These SDKs are provided by the AWS Amplify Framework.

AWS Amplify is a mobile and web toolset that AWS offers to help developers create scalable front-end applications. Amplify supports Javascript, React, Angular, Vue and Next.JS on the web side, and Android, IOS, React Native, Ionic, and flutter for the mobile side. (hurray list of tech names)

Now you might be asking - do I really have to use Amplify and this mobile SDK? The answer is no you don't have to, you can of course just call the server-side APIs directly. But there is a reason that AWS wants you to use amplify and these mobile SDKs. In general, they have been working on this suite of SDKs for a while, and they think it will be easier for you, than doing it yourself.

Anywhoo,  you will have to install the Amplify dependencies and reference them within your application. That will look a little something like this for web.

And somewhere within your applications start/entry point, you will need to reference those libraries.

I want to point out the last line here (the configure part) and show what the might entail. You can have this reference an external file or can set it up within your application itself. Either way, it might look something like this.

All we are doing here is letting Amplify / Cognito know what user pools and identity pools we actually care about, what region to find them in, and any other qualifying information your authentication process might need. In this example the Cognito region is us-east-1, we specify the pool ID, a web client ID (this is just an APP id), an identity pool id, and whether or not we will allow users to get AWS creds if they are not signed in.

You can have a lot more information here if you need it of course.

When your users need to sign to upload their scores - the code will look something like the following.

Since we have already configured all the extra information previously, we just have to send a username and password with this function for allowing sign-in.

And as we mentioned before, you can have a backend process listening for all of these sign-in and authentication event and having some kind of work done in response to them.

Once your users are signed in and authenticated - they can then send their high scores to whatever leaderboard mechanisms they need.

For more direct information about using Amplify, Cognito, and the specifics around how to set up web and mobile authentication, dive into the docs over here: 

https://docs.amplify.aws/lib/auth/getting-started/q/platform/js

 

About the Author
Avatar
Stuart Scott
AWS Content Director
Students
169772
Labs
1
Courses
139
Learning Paths
96

Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data center and network infrastructure design, to cloud architecture and implementation.

To date, Stuart has created 90+ courses relating to Cloud reaching over 140,000 students, mostly within the AWS category and with a heavy focus on security and compliance.

Stuart is a member of the AWS Community Builders Program for his contributions towards AWS.

He is AWS certified and accredited in addition to being a published author covering topics across the AWS landscape.

In January 2016 Stuart was awarded ‘Expert of the Year Award 2015’ from Experts Exchange for his knowledge share within cloud services to the community.

Stuart enjoys writing about cloud technologies and you will find many of his articles within our blog pages.