Using DynamoDB and Web Identity Federation
Let’s say you are developing a game application or any other web application on AWS public cloud platform that uses DynamoDB for storing all application related data. Now, if your application is expected to have thousands of user then it will not be viable for you to create IAM user and then provide these users access to the tables in Dynamo DB for storing application related data, like their score in case of a game or shopping cart etc. Solution to this scenario is use Web Identity Federation which will leverage user’s existing accounts on Google, Facebook or any other identity provider, to provide temporary access to the Dynamo DB data.
Let’s look into an example on how to make configurations for this.
1. Create DynamoDB table and call it ‘Score’
2. Create Partition key and a Sort key. Complete creation of the table.
3. Go to ‘Access control’ and select ‘Facebook’ as the identity provider or any other as per your requirement.
4. Select the ‘Actions’ that you want to allow your users to perform.
5. Select the ‘Attributes’ that you want your users to have access to.
6. Select Create policy and copy the code generated in the policy panel. See the snapshot below
1. Go to IAM console and select “Create Policy. Under the JSON tab, paste the code that you copied in step 6 of above section i.e. DynamoDB Configurations. Move to next page.
1. Give the policy a name, for example, ‘DynamoDB-Policy’ and complete the policy creation process.
2. Now, create a new role.
3. Select Web Identity as the Trusted Identity of your role.
4. Select ‘Facebook’ as the Identity Provider and enter the applications id that you retrieved from your Facebook development account.
1. Go to ‘Next: Permissions’ screen and search for the policy you just created. Type In your policy name, for example ‘DynamoDB-Policy’ in this case and select it and move to next step.
2. Provide the role a name and description.
One this setup is in place, you can start developing your application that uses social media identity providers like Facebook in this example to authenticate and authorize your users. You also have the option to use Amazon Cognito that is best fit for quickly and easily managing your users coming through third part identity providers.
Bluestack IT Solutions