我要做的就是从本质上使用具有远程实例中存在的数据(例如放大登台环境/API)并在本地导入的确切的DynamDB表。
我看了DataSync,但这似乎只是Fe。我想从分阶段并同步该数据与我的本地放大实例中获取确切的数据 - 这甚至可以吗?我找不到目前正在帮助的任何信息。
非常习惯于使用Mongo/Postgres等。从字面上看,可以进行数据库转储并导入……我可能在这里缺少一些东西?
All I want to do is essentially take the exact dynamdb tables with their data that exist in a remote instance ( e.g. amplify staging environment/api) and import those locally.
I looked at datasync but that seemed to be FE only. I want to take the exact data from staging and sync that data to my local amplify instance - is this even possible? I can't find any information that is helping right now.
Very used to using mongo/postgres etc. and literally being able to take a DB dump and just import that...I may be missing something here?
发布评论
评论(3)
continue
How about using dynamodump
Download the data from AWS to your local machine:
Then import to Local DynamoDB:
您必须构建一个从在线DynamoDB中读取的自定义脚本,然后填充本地DynamoDB。我发现Docker映像非常适合拥有一个实例,请确保给出JAR文件名以防止图像是短暂的并具有数据的持久性。
宏观指示:
下载Docker桌面(如果需要)
启动Docker桌面和在终端中要求Dynamo DB官方图像:
https://hub.docker.com/r/r/amazon/dynamodb-local/
然后运行Docker容器:
现在您可以启动一个python脚本从在线数据库中获取数据并在本地DynamoDB中复制,如官方文档:
https://docs.aws.aws.amazon.com/prescriptive-guidance/latest/latest/patter/patter/patterns/copy-amazon-dynamodb, -tables-across-accounts-using-a-custom-implement.html
确定与本地容器的连接(Localhost:8000),您应该能够复制所有数据。
You have to build a custom script that reads from the online DynamoDB and then populate the Local DynamoDB. I found the docker image be just perfect to have an instance, make sure to give the jar file name to prevent the image to be ephemeral and have persistence of data.
Sort of macro instructions:
Download Docker Desktop (if you want)
Start docker desktop and in a terminal ask for Dynamo DB official image:
https://hub.docker.com/r/amazon/dynamodb-local/
And then run the docker container:
Now you can start a python script that get the data from the online DB and copy in the local dynamoDB, as in official docs:
https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/copy-amazon-dynamodb-tables-across-accounts-using-a-custom-implementation.html
Working out the connections to the local container (localhost:8000) you shall be able to copy all the data.
我不太精通本地放大实例,但是对于DynamoDB而言,您可以在本地使用 dynamodb local 。
可在此处找到DynamoDB本地的下载说明的完整列表:
如果您在本地计算机中安装了Docker,则可以轻松下载并使用几个命令开始DynamoDB本地服务:
下载
Docker Pull Amazon/dynamodb-local
Run
Docker Run -name DynamoDB -P 8000:8000 -D Amazon/dynamodb -local -jar db.jar
这将使您可以在本地使用90%的dynamoDB功能。但是,将数据从DynamoDB Web服务迁移到DynamoDB本地并不是开箱即用的东西。为此,您需要创建一个您本地运行的小脚本,从现有表中读取数据并写入本地实例。
可以在此处的文档中找到从一张桌子读取并写入第二个的示例:复制帐户中的Amazon DynamodB表
您要进行的一个更改是手动设置
endpoint_url DynamoDB本地:
I'm not too well versed on local Amplify instances, but for DynamoDB there is a product which you can use locally called DynamoDB Local.
Full list of download instructions for DynamoDB Local are available here: Downloading And Running DynamoDB Local
If you have docker installed in your local machine, you can easily download and start the DynamoDB Local service with a few commands:
Download
docker pull amazon/dynamodb-local
Run
docker run --name dynamodb -p 8000:8000 -d amazon/dynamodb-local -jar DB.jar
This will allow you to avail of 90% of DynamoDB features locally. However, migrating data from DynamoDB Web Service to DynamoDB local is not something that is provided out of the box. For that, you would need to create a small script which you run locally, read data from your existing table and write to your local instance.
An example of reading from one table and writing to a second can be found in the docs here: Copy Amazon Dynamodb Tables Across Accounts
One change you will have make is manually setting the
endpoint_url
for DynamoDB Local: