Update Config files during EBS volumes swap
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?
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
Thank you. I shall give a try and let you know.
Is it working do you have feedback?
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 ?
AWS Backup - two ec2 instances are assigned as the protected services - but I see an EBS snapshot in the vault?asked 5 months ago
EBS snapshots and S3 encryptionasked 2 years ago
Restriction on number of EBS volumes per EC2 ?Accepted Answerasked 2 years ago
Is it redundant to have an EC2 instance and its EBS volumes in the same AWS Backup resource assignment?Accepted Answerasked 5 months ago
How to migrate only postgres data using EBS volumesasked 2 months ago
Multiple EBS volumes to gain perfomanceAccepted Answerasked 5 months ago
EBS Snapshot - Retention complance & ExportAccepted Answerasked 4 years ago
EBS gp3 volumes in Severely Degraded stateasked a month ago
Update Config files during EBS volumes swapasked 2 months ago
Unmount Linux File-systems Before SnapshotAccepted Answerasked 4 months ago