Creating instance templates
Instance templates define various characteristics of an instance and related attributes. Some of these attributes are:
- Machine type (f1-micro, n1-standard-1, custom)
- Image (we created one in the previous tip, app-image)
- Zone (us-west1-a)
- Tags (we have a firewall rule for tag
http
)
How to do it…
Once a template is created, we can use it to create a managed instance group which can be auto-scale based on various parameters. Instance templates are typically available globally as long as we do not specify a restrictive parameter like a specific subnet or disk:
- name: create instance template named app-template gce_instance_template: name: app-template size: f1-micro tags: http,http-server image: app-image state: present subnetwork: public-subnet subnetwork_region: us-west1 service_account_email: "{{ service_account_email }}" credentials_file: "{{ credentials_file }}" project_id: "{{ project_id }}" tags: - recipe9
We have specified...