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 réponses
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
répondu il y a 2 ans
  • 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 ?

répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions