怎样通过CloudFormation来给DocumentDB创建一些表和索引(how to create some table and index in DocumentDB by CloudFormation)

0

问题如标题,怎么通过CloudFormation来给DocumentDB创建一些表和索引 Questions such as titles, how to create some tables and indexes for DocumentDB through CloudFormat

我的项目现在在使用documentdb,还有S3桶,但是每次在配置新的环境时候,documentdb中所有的集合和索引,还有S3中的一些文件都需要手动再导入,如果忘记了就会遗漏,有什么办法可以让这些都自动导入吗~这样以后更新各个环境的时候就只需要维护一个就好了.

My project is currently using documentdb and S3 bucket, but every time I configure a new environment, all the collections and indexes in documentdb, as well as some files in S3, need to be manually imported. If I forget them, I will miss them. Is there any way to automatically import them? This way, when updating each environment in the future, only one needs to be maintained.

profile picture
Dgk
asked 9 months ago252 views
1 Answer
1
Accepted Answer
profile picture
EXPERT
answered 9 months ago
profile pictureAWS
EXPERT
reviewed 9 months ago
  • OK, Thanks for you answer. but I need to create tables and indexes when I want build a new environment, I don't want to manually create them. What should I do,Are there any good methods for automatic creation.looking for your answer.ありがとうございました!

  • If you do this with CloudFormation, I believe there is a way to create a custom resource and connect to it from a Lambda function to create the table. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources-lambda.html
    If you want to operate in Python, I believe pymongo can be used. https://pymongo.readthedocs.io/en/stable/

  • ok, thanks you~ Maybe I need to write a Lambda function to solve this problem.>﹏<, emmm, I have another question, How to automatically import S3 buckets by CloudFormation. I have made some additions to my question,could you also answer this question~ thank you very much!

  • I think we need to use Lambda with custom resources for new questions as well. DocumentDB internal operations are basically not supported by CloudFormation and must be automated by creating custom resources, etc.

  • ok~~~~~,thank you very much! I should study (Lambda with custom resources) as soon as possible. Is this difficult to learn?(っ °Д °;)っ anyway,thank you very much!!!have a nice day []( ̄▽ ̄)*

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions