Creating Dynamo DB Table, EC2 Instance and using AWS CLI to scan the Dynamo DB Table.

  • Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.
  • It's a non-relational, key-value type of database.
  • Provides very low latency, Data is stored on SSD storage.
  • Multi-AZ redundancy and Cross-Region Replication option.
  • The underlying hardware storing data is spread across 3 geographically distinct data centres.
  1. Create a DynamoDB table for something of your choosing (e.g. movies, food, games)
  2. Add 10 or more items to the table
  3. Create a t.2micro Ec2 instance
  4. Using an IAM role and the principle of least privilege, grant the EC2 instance read access to DynamoDB.
  5. Use the AWS CLI in the EC2 instance to scan the DynamoDB table
  6. Use the AWS CLI in the EC2 instance to validate you cannot write an item to the DynamoDB table
Instance launched
  • Go to IAM>>Roles>>Create Role>>Add AmazonDynamoDBReadOnlyAccess as policy and create the role.
updating the IAM policy on the instance
was dynamodb scan --table-name <table-name> --region <region-name>
AWS CLI — DynamoDB scanning in process
$ aws dynamodb put-item --table-name Xbox_Games --item ‘{“Game_Titles”: {“S”: “GTA5”},}’ --region us-east-1 --return-consumed-capacity TOTAL
Permission denied upon attempting to add data to DynamoDB Table
aws dynamodb put-item --table-name Xbox_Games --item ‘{“Game_Titles”: {“S”: “GTA5”},”Developers”:{“S”:”RockStar Games”}}’ --region us-east-1 --return-consumed-capacity TOTAL
adding data to the dynamoDB table
GTA5 added to the DynamoDB Table

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Manminder Singh

Manminder Singh

DevOps Trainee | 3x AWS Certified | Linux Certified | Former IT HR | Naval Brat