Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
163 views
in Technique[技术] by (71.8m points)

javascript - Run the git commands inside AWS lambda(Nodejs runtime)

We have a very different type of requirement that, we have follow microservices and we need to have a backup of our database to a seperate a repository. i am using aws codecommit for both lambda code and backups.

How the Backups are creating: have a lambda "GenerateLambda" which is generate database backup, i need to deploy that file into seperate repo by cloning that repo programatically. The steps which i follws:

  • Inside the GenerateBackup lambda, i have added code for cloning the backup (Shallow cloning) using node exec

  • Clone the backup repository to /tmp/backups

  • Now i need to create backup ( say cron job once a day)

  • Create a backup.JSON and i am looking run git diff /path/to/created/backup.json /tmp/backup/backup.json

  • if git diff return non empty string i need to put the newly created file/copy the newly created file to /tmp/backup and run git add. and git commit -m "Timestamp" and finally push

I already implemented s3 way with ETag to remove duplicates, the reason which i use git, then i can track the revision or the changes very easily

want to know that, is there any better way which differs from the above steps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...