The DynamoDB setup only includes the access of your AWS account through which the DynamoDB GUI console can be accessed. However, a local installation can also be done for the same purpose.
Creating AWS account:
- Visit the following website:- https://aws.amazon.com/dynamodb/
- Click on the “Get Started with Amazon DynamoDB” button, or the “Create an AWS Account” button.
- Fill in the required information for account creation.
- Choose the plan that best suits you and you are good to go.
After the above steps, you can sign in to the AWS console and then navigate to the DynamoDB console.
AWS (Amazon Web Service) provides a version of DynamoDB for local installations. Applications can be created in this type of setup without any web connection. It also significantly diminishes provisioned throughput, data storage, and transfer fees by allowing a local database.
Deployment of applications created on local installation can be done by making small changes to it for AWS use.
To set up DynamoDB locally follow the below steps:
- Download DynamoDB .tar file specific to your area using one of the following link:- https://s3.ap-south-1.amazonaws.com/dynamodb-local-mumbai/dynamodb_local_latest.tar.gz
- After you download the archive, extract the contents, and copy the extracted directory to a location of your choice.
- To start DynamoDB on your computer, open a command prompt window, navigate to the directory where you extracted DynamoDBLocal.jar, and enter the following command.
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
- Before you can access DynamoDB programmatically or through the AWS Command Line Interface (AWS CLI), you must configure your credentials to enable authorization for your applications. Downloadable DynamoDB requires any credentials to work, as shown in the following example.
AWS Access Key ID: "YourKeyId" AWS Secret Access Key: "YourSecretAccessKey"
- Start writing applications. To access DynamoDB running locally with the AWS CLI(Command Line Interface), use the –endpoint-url parameter. For example, use the following command to list DynamoDB tables.
aws dynamodb list-tables --endpoint-url http://localhost:8000
Now your local installation is all set and you can start building your application.
At the deployment stage, you will need to make changes to your code. The changes depend on code language and a few other factors. The primary change consists of altering the endpoint from a local point to an AWS region. Other changes are based on requirement centric analysis of your application.
Difference between local and web-based setup:
The key difference between the local setup and web-based setup of DynamoDB are listed below:
- Tables are created instantaneously in local setup but the services provided by AWS consume more time.
- Generally, the local installation ignores throughput.
- The process of deletion is instantaneous in the local setup.
- Alteration of data is quicker as compared to the web-based setup due to absence of the network overhead.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.