#Serverless authenticated message board example
Example of backend Serverless framework for an abstract message board. Api Gateway endpoints are authenticated with caller credentials from an AWS Cognito Federated Identity pool. The message board uses AWS ApiGateway with Lambda and DynamoDB to store the messages. Api Gateway endpoints are authenticated with AWS_IAM ("Invoke with caller credentials" option) given by Cognito.
While the serverless.yml defines the Api Gateway endpoints, lambda and dynamodb. You need (as instructed below) to create the Cognito Identity pool manually and set it's IAM role (explained).
Important Note: Running the example has a financial cost, please be aware and see the AWS pricing system for each service. Example not for production use!
Install Serverless Framework - See Instructions
(Also see Using Federated Identities)
Facebook Application:
- Go to Facebook developers console
- Create a new app
- Allow login permission
- Copy app id
Cognito:
- Manage Federated Identities
- Create a new Identity pool
- Fill up pool name
- Make sure Enable access to unauthenticated identities is unchecked!
- In Authenticated providers, in Facebook tab fill the Facebook App ID
- Create pool
- Create Default roles.
IAM Role:
- Go to IAM from the AWS Console
- Find the role previosuly created for authenticated access.
- In Managed Policies add: ..A) AmazonAPIGatewayInvokeFullAccess ..B) AWSLambdaExecute ..C) AWSLambdaBasicExecutionRole
- Clone the project
- CD to the project's folder/directory
- sls deploy
Once the service is set, an endpoint URL is created. Copy the path to the created API and paste it in the client as instructed in the serverless-auth-msg-board-unity3d-client README.md file.