Hackernoon logoHow To Integrate Your Laptop With AWS And Deploy DynamoDB Locally by@sachin962

How To Integrate Your Laptop With AWS And Deploy DynamoDB Locally

image
Sachin Malviya Hacker Noon profile picture

@sachin962Sachin Malviya

I am IT professional and working on AWS technology, self learner and Innovator.

How to Interact with AWS (Amazon Web Services) cloud from your local machine. More specifically using python IDE to handle easily. Here I have explained how to connect local machine to create, access your DynamoDB
table

What is DynamoDB ?

DynamoDB works and managed by NoSQL. Using DynamoDB we can
create table and retrieve the data from table any amount of data. As it doesn’t depend on server, hardware so dependency system/server hardware so, more reliable.

This post basically how to interact or set up access from
your local system to AWS account to create, manage, and get table information from AWS in very simple way like without installing any additional things. Here I have shown for windows operating system.

Pre-requisites:-

  • You must have an AWS account. It can be free tier version
  • Laptop with jupytor Notebook python IDE.
  • Initial knowledge of python.

Step 1:

  • Login to the AWS console go to the IAM (Identity Access Manager) services.
  • Create a user or if you have an existing user so no need to create again. However this user should have programming privilege to perform required operation in my case I have given full privilege access.
image
image
image
  • Then keep the other settings as default and click on review and save.
  • In my case user is “testuser”
  • After successful creation of user it will show us access key and secret key which is one of the most important part of this integration, it looks like below
image

Step 2: Copy and save at secret folder it is user identity which identifies the user uniquely.

Now we have done for credential part, now few essential thing we need to done at AWS console side.

  • Select the availability region in where we required this database to read or write.
  • It is recommend from AWS to select availability zone which is nearer to your Geo location. Below region are there at very first of AWS console at most right above corner.
image

Step 3:

Now to program AWS console from your laptop we need to configure few thing which are explained as below:-

  • Go the command line prompt from start by simply typing ‘cmd’ a black window would appear.
  • Then type command “aws configuration” then press enter
image

As far as we hit the enter it will give prompt to put access key, secret key, region name & output format.

image
image

Step 4:

Till this steps our machine has ready to interact with AWS.
Now we need to deal with programming part here we will us python as programming language to perform read , write and related operation.

  • Install jupytor Notebook which is IDE for python coding.
  • To interact with AWS to python we required library or SDK (Software Development Kit). AWS has Boto SDK for python. It enables developer to configure, modify using interactive script.
  • Install boto3 package as we install other packages in python
image
  • Now import the library in coding after boto3 package would allow us to work with AWS terminologies like dynamoDB services, table creation, data loading into the table and data retrieve.

Here I am creating table a table name ‘testuser’ into dynamodb
database which has few attributes like first name and last name of some
students. Both attributes are string type. Please the below code

image
  • Once you execute this program in jupytor notebook wait for code execution and refresh the AWS console under AWS dynamoDB services. Here you go….after few seconds table created named as testuser with defined attributes.
image
  • If we run few more command to see what this new table contain like how many item we will get output as zero.
image
  • Now we want to write some data to the table ‘testusers’. So, by caling put_item method we can do that
image
  • Similarly we can read the data from table with the help of primary key attribute using get_item method.
image

Output:

image
  • As above read and write operation we can perform other operation as well like delete the particular item, add more item to the table

So, We have integrated our machine with AWS and we can create and manage table from our laptop. Please me know if any query at any step i would be happy to help......Thanks for Reading...

Sachin Malviya Hacker Noon profile picture
by Sachin Malviya @sachin962. I am IT professional and working on AWS technology, self learner and Innovator. Read my stories

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.