< Back

Add-GceInstanceTemplate

Mon Jan 13, 2020 11:00 pm

NAME Add-GceInstanceTemplate



SYNOPSIS

Adds an instance template to Google Compute Engine.





SYNTAX

Add-GceInstanceTemplate [-Project <string>] [-Object] <InstanceTemplate> [-Label <Hashtable>] [<CommonParameters>]



Add-GceInstanceTemplate [-Project <string>] [-Name] <string> [[-MachineType] <string>] [-CanIpForward

<SwitchParameter>] [-Description <string>] [-BootDiskImage <Image>] [-ExtraDisk <Disk[]>] [-Disk <AttachedDisk[]>]

[-Metadata <IDictionary>] [-Network <string>] [-Region <string>] [-Subnetwork <string>] [-NoExternalIp

<SwitchParameter>] [-Preemptible <SwitchParameter>] [-AutomaticRestart <bool>] [-TerminateOnMaintenance

<SwitchParameter>] [-ServiceAccount <ServiceAccount[]>] [-Tag <string[]>] [-Label <Hashtable>] [<CommonParameters>]



Add-GceInstanceTemplate [-Project <string>] [-Name] <string> -CustomCpu <int> -CustomMemory <int> [-CanIpForward

<SwitchParameter>] [-Description <string>] [-BootDiskImage <Image>] [-ExtraDisk <Disk[]>] [-Disk <AttachedDisk[]>]

[-Metadata <IDictionary>] [-Network <string>] [-Region <string>] [-Subnetwork <string>] [-NoExternalIp

<SwitchParameter>] [-Preemptible <SwitchParameter>] [-AutomaticRestart <bool>] [-TerminateOnMaintenance

<SwitchParameter>] [-ServiceAccount <ServiceAccount[]>] [-Tag <string[]>] [-Label <Hashtable>] [<CommonParameters>]





DESCRIPTION

Adds an instance template to Google Compute Engine. These templates can be used to create managed instance groups.





PARAMETERS

-Project <string>

The project that will own the instance template.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Object <InstanceTemplate>

An instance template object to add to Google Compute Engine.



Required? true

Position? 0

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Name <string>

The name of the new instance template.



Required? true

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-MachineType <string>

The name of the machine type for this template. Defaults to n1-standard-1.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CustomCpu <int>

Number of vCPUs used for a custom machine type. This has to be used together with CustomMemory.



Required? true

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-CustomMemory <int>

Total amount of memory used for a custom machine type. This has to be used together with CustomCpu. The amount

of memory is in MB.



Required? true

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-CanIpForward <SwitchParameter>

Enables instances to send and receive packets for IP addresses other than their own. Switch on if these

instances will be used as an IP gateway or it will be set as the next-hop in a Route resource.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Description <string>

Human readable description of this instance template.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BootDiskImage <Image>

The the image used to create the boot disk. Use Get-GceImage to get one of these.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ExtraDisk <Disk[]>

An existing disk to attach. All instances of this template will be able to read this disk. Will attach in read

only mode.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Disk <AttachedDisk[]>

An AttachedDisk object specifying a disk to attach. Do not specify `-BootDiskImage` or `-BootDiskSnapshot` if

this is a boot disk. You can build one using New-GceAttachedDiskConfig.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Metadata <IDictionary>

The keys and values of the Metadata of this instance.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Network <string>

The name of the network to use. If not specified, it is global/networks/default. This can be a string, or

Network object you get from Get-GceNetwork.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Region <string>

The region in which the subnet of the instance will reside. Defaults to the region in the Cloud SDK config.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Subnetwork <string>

The name of the subnetwork to use.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NoExternalIp <SwitchParameter>

If set, the instances will not have an external ip address.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Preemptible <SwitchParameter>

If set, the instances will be preemptible, and AutomaticRestart will be false.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-AutomaticRestart <bool>

If set, the instances will not restart when shut down by Google Compute Engine.



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-TerminateOnMaintenance <SwitchParameter>

If set, the instances will terminate rather than migrate when the host undergoes maintenance.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ServiceAccount <ServiceAccount[]>

The ServiceAccount used to specify access tokens. Use New-GceServiceAccountConfig to build one.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tag <string[]>

A tag of this instance.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Label <Hashtable>

The map of labels (key/value pairs) to be applied to the instance.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

Google.Apis.Compute.v1.Data.InstanceTemplate

An instance template object to add to Google Compute Engine.





OUTPUTS

Google.Apis.Compute.v1.Data.InstanceTemplate





---------- EXAMPLE 1 ----------



PS C:\\> $image = Get-GceImage -Family "window-2012-r2"

PS C:\\> Add-GceInstanceTemplate "my-template" -BootDiskImage $image



Creates a new windows 2012 instance template with default settings.

---------- EXAMPLE 2 ----------



PS C:\\> $image = Get-GceImage -Family "window-2012-r2"

PS C:\\> Add-GceInstanceTemplate "my-template" -BootDiskImage $image -Subnetwork "my-subnet"



Creates a new windows 2012 instance template with default settings and uses subnetwork "my-subnet".

---------- EXAMPLE 3 ----------



PS C:\\> $image = Get-GceImage -Family "window-2012-r2"

PS C:\\> $serviceAccount = New-GceServiceAccountConfig default -BigQuery

PS C:\\> Add-GceInstanceTemplate $name "n1-standard-4" -BootDiskImage $image `

-ServiceAccount $serviceAccount



Creates a new instance template for a 4 core machine that has access to BigQuery.



RELATED LINKS

[Instance Template resource definition]

(https://cloud.google.com/compute/docs/r ... s#resource)