I am using EC2 instances for hosting my nodejs web application which is in a private github repo. I want to make this autoscaling so I moved user_data
script to a aws_launch_configuration
.
My question is how can I create a CICD Pipeline(Github Workflows) to deploy my code latest code to EC2 when I pushed to branch.
And I want to pull the latest code to the EC2 when it is autoscaling.
My Current TF
resource "aws_launch_configuration" "awslc" {
name_prefix = "asg-"
image_id = "ami-09e647bf7a368e505"
instance_type = "t2.micro"
user_data = file("user-data.sh")
security_groups = []
lifecycle {
create_before_destroy = true
}
}
I have a private repo, how can I pull the latest code for this?
# Clone website code
echo "Cloning website"
mkdir -p /demo-website
cd /demo-website
git clone https://github.com/test.git . ????
I dont want to use PAT(Personal Access Tokens), what alternates I have here?
Thanks
1