Search code examples
amazon-web-servicesgithubamazon-amiaws-auto-scaling

How can I make an AMI (ASG instance) start with the code from a github branch?


I already configure the Code build/CI/CD pipeline when pushing in a branch in Github, but when an instance launchs from the ASG it starts with no code, the only approach i can think of is with an AMI, but how can i make this AMI start with the latest code in Github? I already installed the git client in an instance but i am afraid that each time this will ask for known host in the boot process, can anyone help me with this please. Thanks!


Solution

  • For that you have to setup user data. You have to write script for the user-data which will perform all initialization that you require at instance launch. This may include download, compiling and running latest versions of programs from git.