Maciek
Maciek

Reputation: 1990

Google Compute Engine Load Balancing with Auto Scaling. Will it copy my website to new instances?

I am new to load balancing and auto scaling. I am using Google compute engine for a website. I also created a instance group with auto scaling capabilities. But now I am confused. Auto scaling creates new instances based on load. But where do I update the website? If I do an SSH connect and update the website on one instance, will this be an update on all the instances in the group?

For example, I want to upload an updated webpage to my /var/www/html/ on my Apache server instance in the instance group. Will it update all the auto scaled instances? When a new instance is added automatically, does it copy the latest updated instance with the website on it?

Upvotes: 0

Views: 134

Answers (3)

guillaume blaquiere
guillaume blaquiere

Reputation: 76073

I recommend you to serve your static content with directly from Cloud Storage. Instead of uploading your HTML page to your server, upload it to Google Cloud Storage and set up your Loadbalancer path according with the static resources base path (for example /static/)

If you want to update a template that will be processed and enriched by your webserver, I recommend you to release a new version and to perform a rolling out of it. Indeed, if you have an issue with this new template, your packaged previous version will be easy to perform and to keep a versioning of these.

Upvotes: 2

narayansharma91
narayansharma91

Reputation: 2353

The short answer is NO If you want to update your application which was using load balancing, The quickest method is rolling update. Please follow the given instructions.

  • Go to group instances page
  • Select the appropriate instance group and click on a rolling update from the detail page.
  • There will be multiple options, that you need to configure for a rolling update based on your requirements. If you don't know what all options mean just click ok with a default value.

I hope it will help you.

Upvotes: 1

Zacharya Haitin
Zacharya Haitin

Reputation: 348

The quick answer is no.

When you created the instance group you chose an instance template, which configure the image, so each new instance will be created from the image in this template.

It's hard for me to give you a full answer since I do not know which deployment method do you use, but if it's a static website maybe you should consider using google cloud storage and google CDN.

If you do want more control and prefer to use google compute with an LB, you can use a few options for deployment:

  1. Creating new template with a new image and use the group "rolling update" option.
  2. Use a startup scripts that download the static data from GCS (or somewhere else, such as github) and use "replace/restart" option in the instance group.
  3. Docker images and google container registry.

There are more options of course, but I think those are the easiest and fastest.

Upvotes: 1

Related Questions