< Back
Add-GceInstance
Post
NAME Add-GceInstance
SYNOPSIS
Creates and starts a Google Compute Engine VM instance.
SYNTAX
Add-GceInstance [-Project <string>] [-Zone <string>] [-InstanceConfig] <Instance> [-Label <Hashtable>]
[<CommonParameters>]
Add-GceInstance [-Project <string>] [-Zone <string>] [-Name] <string> [[-MachineType] <string>] [-CanIpForward
<SwitchParameter>] [-Description <string>] [-BootDisk <Disk>] [-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>] [-Address <string>] [<CommonParameters>]
Add-GceInstance [-Project <string>] [-Zone <string>] [-Name] <string> -CustomCpu <int> -CustomMemory <int>
[-CanIpForward <SwitchParameter>] [-Description <string>] [-BootDisk <Disk>] [-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>] [-Address <string>] [<CommonParameters>]
DESCRIPTION
Creates and starts a Google Compute Engine VM instance. You create a new instance by either using an instance
config created by New-GceInstanceConfig, or by specifying the parameters you want on this cmdlet.
PARAMETERS
-Project <string>
The project that will own the instance.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Zone <string>
The zone in which the instance will reside.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-InstanceConfig <Instance>
The definition of the instance to create.
Required? true
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Name <string>
The name of the instance to add.
Required? true
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-MachineType <string>
The machine type of this instance. Can be a name, a URL or a MachineType object from Get-GceMachineType.
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 this
instance 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.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-BootDisk <Disk>
The persistant disk to use as a boot disk. Use Get-GceDisk to get one of these.
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
-DiskImage <Image>
The the image used to create the boot disk. Use Get-GceImage to get one of these.
This is an alias of the BootDiskImage parameter.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ExtraDisk <Disk[]>
An existing disk to attach. It 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, is default. This can be a 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 instance 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 instance will be preemptible. If set, AutomaticRestart will be false.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-AutomaticRestart <bool>
If set, the instance 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 instance 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
-Address <string>
The static ip address this instance will have. Can be a string, or and Address object from Get-GceAddress.
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.Instance
The definition of the instance to create.
System.String
The name of the instance to add.
OUTPUTS
Google.Apis.Compute.v1.Data.Instance
---------- EXAMPLE 1 ----------
PS C:\\> New-GceInstanceConfig -Name "new-instance" -BootDiskImage $image |
Add-GceInstance -Project "my-project" -Zone "us-central1-a"
Creates a new instance from an instance config.
---------- EXAMPLE 2 ----------
PS C:\\> Add-GceInstance -Name "new-instance" -BootDisk $disk `
-MachineType "n1-standard-4" `
-Tag http, https `
-Metadata @{"windows-startup-script-ps1" =
"Read-GcsObject bucket object -OutFile temp.txt"}
Creates a new instance in the default project and zone. The boot disk is the prexisting disk stored in $disk, the
machine type has 4 cores, it runs a script on startup, and it is tagged as an http and https server.
---------- EXAMPLE 3 ----------
PS C:\\> Add-GceInstance -Name "new-instance" -BootDisk $disk `
-MachineType "n1-standard-4" `
-Subnetwork "my-subnetwork" `
-Address "10.128.0.1"
Creates a new instance in the default project and zone. The boot disk is the prexisting disk stored in $disk, the
machine type has 4 cores, it uses the subnetwork "my-subnetwork" and the ip address "10.123.0.1" (this address
must be within the subnetwork).
RELATED LINKS
[Instance resource definition] (https://cloud.google.com/compute/docs/r ... s#resource)
SYNOPSIS
Creates and starts a Google Compute Engine VM instance.
SYNTAX
Add-GceInstance [-Project <string>] [-Zone <string>] [-InstanceConfig] <Instance> [-Label <Hashtable>]
[<CommonParameters>]
Add-GceInstance [-Project <string>] [-Zone <string>] [-Name] <string> [[-MachineType] <string>] [-CanIpForward
<SwitchParameter>] [-Description <string>] [-BootDisk <Disk>] [-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>] [-Address <string>] [<CommonParameters>]
Add-GceInstance [-Project <string>] [-Zone <string>] [-Name] <string> -CustomCpu <int> -CustomMemory <int>
[-CanIpForward <SwitchParameter>] [-Description <string>] [-BootDisk <Disk>] [-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>] [-Address <string>] [<CommonParameters>]
DESCRIPTION
Creates and starts a Google Compute Engine VM instance. You create a new instance by either using an instance
config created by New-GceInstanceConfig, or by specifying the parameters you want on this cmdlet.
PARAMETERS
-Project <string>
The project that will own the instance.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Zone <string>
The zone in which the instance will reside.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-InstanceConfig <Instance>
The definition of the instance to create.
Required? true
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Name <string>
The name of the instance to add.
Required? true
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-MachineType <string>
The machine type of this instance. Can be a name, a URL or a MachineType object from Get-GceMachineType.
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 this
instance 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.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-BootDisk <Disk>
The persistant disk to use as a boot disk. Use Get-GceDisk to get one of these.
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
-DiskImage <Image>
The the image used to create the boot disk. Use Get-GceImage to get one of these.
This is an alias of the BootDiskImage parameter.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ExtraDisk <Disk[]>
An existing disk to attach. It 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, is default. This can be a 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 instance 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 instance will be preemptible. If set, AutomaticRestart will be false.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-AutomaticRestart <bool>
If set, the instance 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 instance 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
-Address <string>
The static ip address this instance will have. Can be a string, or and Address object from Get-GceAddress.
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.Instance
The definition of the instance to create.
System.String
The name of the instance to add.
OUTPUTS
Google.Apis.Compute.v1.Data.Instance
---------- EXAMPLE 1 ----------
PS C:\\> New-GceInstanceConfig -Name "new-instance" -BootDiskImage $image |
Add-GceInstance -Project "my-project" -Zone "us-central1-a"
Creates a new instance from an instance config.
---------- EXAMPLE 2 ----------
PS C:\\> Add-GceInstance -Name "new-instance" -BootDisk $disk `
-MachineType "n1-standard-4" `
-Tag http, https `
-Metadata @{"windows-startup-script-ps1" =
"Read-GcsObject bucket object -OutFile temp.txt"}
Creates a new instance in the default project and zone. The boot disk is the prexisting disk stored in $disk, the
machine type has 4 cores, it runs a script on startup, and it is tagged as an http and https server.
---------- EXAMPLE 3 ----------
PS C:\\> Add-GceInstance -Name "new-instance" -BootDisk $disk `
-MachineType "n1-standard-4" `
-Subnetwork "my-subnetwork" `
-Address "10.128.0.1"
Creates a new instance in the default project and zone. The boot disk is the prexisting disk stored in $disk, the
machine type has 4 cores, it uses the subnetwork "my-subnetwork" and the ip address "10.123.0.1" (this address
must be within the subnetwork).
RELATED LINKS
[Instance resource definition] (https://cloud.google.com/compute/docs/r ... s#resource)