Problem:
Need to create tables in DynamoDB from AWS Console.
Solution Summary:
We can create DynamoDB tables from DynamoDB dashboard in the AWS console.
Prerequisites:
This lab assumes you have followed previous labs and created a user with necessary permissions, installed awscli, and created and setup profile in local.
Creating User:
-
Create a new user: Users > Add User > Give a name (e.g. dynamodbadmin ) , Select both access types (programmatic access, console access with custom password), Attach existing policy directly (add Administrator Access policy). Once the success message appears download credentials, as you will not be able to get it later.
-
For tracking the cost, you can also activate IAM User Access to Billing Information, by going to My Account tab from the user drop down (top right). It may be also a good idea to set up MFA.
-
Log off and login to the account using the newly created user (Use the IAM users sign-in link customized earlier).
Setting up local:
Though you can install AWS CLI using windows installer easily, we will do it using python and pip, as for other environments (e.g. Mac, Linux) that is the preferred way.
Solution Steps:
- Login to AWS console using the sign in link and user created for dynamodob.
- Go to DynamoDB dashboard
-
Click on ‘Create Table’ button.
- Give name as: course_data
- Give Primary key/Partition key as: course_id with String data type.
- Give Primary key/Sort key as: dateandtime with String data type.
- Leave the option ‘Use default settings’ selected.
- Click ‘Create’.
- Wait until the progress symbol disappears.
- You can go to dashboard to see any alarm triggers or service health issues, and capacity details. Tables will show you table details. Clicking on table name will show you details for the table. Following are the tabs for table: Overview, Items, Metrics, Alarms, Capacity, Indexes, Triggers, Access Control, Tags.
- Click on our table and go to Items tab.
- Click on Create Item button. You will be asked to provide values for the key fields, which you cannot skip. Give valid values: c001, 2017/4/30 00:00. Click Save
- Create another Item: Give valid values for keys: c002, 2017/4/30 00:00. Click on the + button alongside dateandtime, click on append to add a field. Give name as ‘duration_in_time’ and type as Number.
- Next we will do similar and more operations from command prompt.
Recent comments