Search code examples
gitamazon-web-servicesversion-controlgitlab

Is there a way to make file changes in AWS EC2 instance using GitLab?


Is there a way to integrate GitLab and AWS EC2 where when I make changes in my repository it also gets updated in the EC2 file structure?

For eg: File structure in EC2 using Linux: /opt has a file (somefunction.js) /etc has a file (someConfig.conf)

If I make changes to these files and push them to my GitLab repo these should automatically get updated in my EC2 instance rather than drag-dropping these files or manually adding them

Any help would be highly appreciated


Solution

  • I am not sure if there is a straight forward way to do it but assuming EC2 instance is web server or app server (non GitLab server), you can use configuration management tool like ansible you can manage not only one but multiple configuration files on multiple EC2 instances. also set trigger on GitLab on commit. this trigger will run the job and make the changes on that EC2 or other EC2 instances.