Update Config files during EBS volumes swap

0

Hi, I set up new EC2 instance for one of our application. Database is restored from backup and I named as DB-copy. Snapshots of current EBS volumes are restored and then attached to the new EC2. This new instance gets copied like production data, call it clone. I then have to stop my application process immediately in new instance , modify the config file to change/point the db parameter to db-copy. Otherwise, my production application will fail saying there is another duplicate instance running.

I’m looking to modify the config file in the snapshot volume via console or CLI and while during volume swap that avoids me in doing manual update. Is there any guidance on achieving this?

Regards

2개 답변
0

Hello

You can use in this way:

  • Create AMI from the Ec2
  • Launch AMI and add user data to modify the config file
#!/bin/bash

/bin/sed -i 's/old-text/new-text/g'  configfile/path

please let me know if you have any questions

Thanks GK

profile picture
GK
답변함 2년 전
  • Thank you. I shall give a try and let you know.

  • Is it working do you have feedback?

0

Hi, Sorry about delayed response. I was on leave. What I’m trying to achieve is modify the file content from db1.AWS.com to db2.AWS.com while the volumes are swapped. In other words, can I modify the value within AWS console or CLI before I swap over the volumes ?

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠