아장아장 개발 일기

AWS DynamoDB Local에 설치하기 본문

개발/AWS

AWS DynamoDB Local에 설치하기

빨간머리 마녀 🍒 2022. 4. 25. 17:32

DynamoDB를 사용할때 로컬에 설치해 cmd에 aws cli 명령어를 사용해 관리가 가능합니다. 어떻게 설치하는지 소개해드리려고 하는데요.

 

먼저 로컬에 설치했을때와 web에서 사용할때의 차이점은 무엇일까요?

 

먼저 아래 aws 문서에 따르면, 로컬에 DB를 설치하면 “처리량, 데이터 스토리지 및 데이터 전송 요금 절감”이 가능하다고 합니다. 아예 무료는 아닌것 같고, web에서 사용할때에 비해 비용이 적게 청구되는 것 같습니다.

DynamoDB Local 설정(다운로드 가능 버전)

 

 

DynamoDB Local 설정(다운로드 가능 버전) - Amazon DynamoDB

이 페이지에 작업이 필요하다는 점을 알려 주셔서 감사합니다. 실망시켜 드려 죄송합니다. 잠깐 시간을 내어 설명서를 향상시킬 수 있는 방법에 대해 말씀해 주십시오.

docs.aws.amazon.com

아래 아티클을 보면 테이블의 용량이 25GB가 넘어가면 그때부터 비용이 청구된다고 하는데, 2018년도 글이라, 좀 더 정확한 정보를 위해서는 AWS에 직접 문의해보는 게 좋을 것 같습니다.

https://blog.yugabyte.com/dynamodb-pricing-calculator-expensive-vs-alternatives/#:~:text=DynamoDB%20charges%20per%20GB%20of,%240.25%20per%20GB%2Dmonth%20thereafter

 

How DynamoDB’s Pricing Works, Gets Expensive Quickly and the Best Alternatives - The Distributed SQL Blog

DynamoDB is AWS’s NoSQL alternative to Cassandra, primarily marketed to mid-sized and large enterprises. The uses cases best suited for DynamoDB include those that require a flexible data model, reliable performance, and the automatic scaling of throughp

blog.yugabyte.com

맨 위의 aws 개발 문서 페이지를 확인하시면, 로컬에서 개발용으로 사용한 뒤, 배포할 준비가 끝나면 코드에서 로컬 DB를 가리키는 소스를 지우고, 대신 Web DB를 가리키도록 하면 된다고 합니다.

 

DynamoDB 로컬 설치 방법

로컬 설치방법은 간단합니다. 아래 페이지를 참고하시면 되는데요.

Deploying DynamoDB Locally on Your Computer

 

Deploying DynamoDB Locally on Your Computer - Amazon DynamoDB

The YAML scripts require that you specify an AWS access key and an AWS secret key, but they are not required to be valid AWS keys for you to access DynamoDB Local.

docs.aws.amazon.com

위 문서 내용을 다시 한번 정리해보자면, ...

 

  1. 위 링크를 열어 본인 region에 맞는 .zip 파일을 다운받습니다. 저는 서울이니 가장 가까운 Tokyo Region을 다운받았습니다.

  2. 다운 받은 파일을 압축 해제하고, 원하는 디렉토리에 해당 파일을 위치시킵니다.

  3. cmd창을 켜고, 파일을 위치시킨 디렉토리로 이동, 아래 명령어를 입력합니다.
    • Mac : java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
    • Window : java -D"java.library.path=./DynamoDBLocal_lib" -jar DynamoDBLocal.jar
  4. aws configure 명령어를 입력하고 아래 네가지 정보를 차례로 입력합니다.
    1. AWS Access Key ID
    2. AWS Secret Access Key
    3. Default region name (ap-northeast-2 등)
    4. Default output format (json/yaml/yaml-stream/text/table 중 택1)
      * 참고 : https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-output-format.html
 

Setting the AWS CLI output format - AWS Command Line Interface

If you output text, and filter the output to a single field using the --query parameter, the output is a single line of tab-separated values. To get each value onto a separate line, you can put the output field in brackets, as shown in the following exampl

docs.aws.amazon.com

 

설정이 완료된 후 aws configure를 입력했을때 모습

 

로컬에 DynamoDB 설치 잘 하셨나요? 혹시라도 궁금하시거나 알려주실 사항이 있다면 댓글 부탁드립니다 :)

 

이어서 cmd 와 AWS CLI를 활용해 DynamoDB 테이블을 관리하는 방법을 소개해드리겠습니다.

Comments