AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Invokes the ModifyInstanceAttribute operation against Amazon Elastic Compute Cloud.

Syntax

Edit-EC2InstanceAttribute
-InstanceId <String>
-Attribute <InstanceAttributeName>
-BlockDeviceMapping <InstanceBlockDeviceMappingSpecification[]>
-DisableApiTermination <Boolean>
-EbsOptimized <Boolean>
-EnaSupport <Boolean>
-Group <String[]>
-InstanceInitiatedShutdownBehavior <String>
-InstanceType <String>
-Kernel <String>
-Ramdisk <String>
-SourceDestCheck <Boolean>
-SriovNetSupport <String>
-UserData <String>
-Value <String>
-PassThru <SwitchParameter>
-Force <SwitchParameter>

Description

Modifies the specified attribute of the specified instance. You can specify only one attribute at a time. To modify some attributes, the instance must be stopped. For more information, see Modifying Attributes of a Stopped Instance in the Amazon Elastic Compute Cloud User Guide.

Parameters

The name of the attribute.
Required?False
Position?Named
Accept pipeline input?False
Modifies the DeleteOnTermination attribute for volumes that are currently attached. The volume must be owned by the caller. If no value is specified for DeleteOnTermination, the default is true and the volume is deleted when the instance is terminated.To add instance store volumes to an Amazon EBS-backed instance, you must add them when you launch the instance. For more information, see Updating the Block Device Mapping when Launching an Instance in the Amazon Elastic Compute Cloud User Guide.
Required?False
Position?Named
Accept pipeline input?False
-DisableApiTermination <Boolean>
If the value is true, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can. You cannot use this paramater for Spot Instances.
Required?False
Position?Named
Accept pipeline input?False
-EbsOptimized <Boolean>
Specifies whether the instance is optimized for EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.
Required?False
Position?Named
Accept pipeline input?False
-EnaSupport <Boolean>
Set to true to enable enhanced networking with ENA for the instance.This option is supported only for HVM instances. Specifying this option with a PV instance can make it unreachable.
Required?False
Position?Named
Accept pipeline input?False
-Force <SwitchParameter>
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter should always be used with caution.
Required?False
Position?Named
Accept pipeline input?False
-Group <String[]>
[EC2-VPC] Changes the security groups of the instance. You must specify at least one security group, even if it's just the default security group for the VPC. You must specify the security group ID, not the security group name.
Required?False
Position?Named
Accept pipeline input?False
-InstanceId <String>
The ID of the instance.
Required?False
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
-InstanceInitiatedShutdownBehavior <String>
Specifies whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
Required?False
Position?Named
Accept pipeline input?False
-InstanceType <String>
Changes the instance type to the specified value. For more information, see Instance Types. If the instance type is not valid, the error returned is InvalidInstanceAttributeValue.
Required?False
Position?Named
Accept pipeline input?False
-Kernel <String>
Changes the instance's kernel to the specified value. We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB.
Required?False
Position?Named
Accept pipeline input?False
-PassThru <SwitchParameter>
Returns the value passed to the InstanceId parameter. By default, this cmdlet does not generate any output.
Required?False
Position?Named
Accept pipeline input?False
-Ramdisk <String>
Changes the instance's RAM disk to the specified value. We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB.
Required?False
Position?Named
Accept pipeline input?False
-SourceDestCheck <Boolean>
Specifies whether source/destination checking is enabled. A value of true means that checking is enabled, and false means checking is disabled. This value must be false for a NAT instance to perform NAT.
Required?False
Position?Named
Accept pipeline input?False
-SriovNetSupport <String>
Set to simple to enable enhanced networking with the Intel 82599 Virtual Function interface for the instance.There is no way to disable enhanced networking with the Intel 82599 Virtual Function interface at this time.This option is supported only for HVM instances. Specifying this option with a PV instance can make it unreachable.
Required?False
Position?Named
Accept pipeline input?False
-UserData <String>
Changes the instance's user data to the specified value. If you are using an AWS SDK or command line tool, Base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide Base64-encoded text.
Required?False
Position?Named
Accept pipeline input?False
-Value <String>
A new value for the attribute. Use only with the kernel, ramdisk, userData, disableApiTermination, or instanceInitiatedShutdownBehavior attribute.
Required?False
Position?Named
Accept pipeline input?False

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required? False
Position? Named
Accept pipeline input? False
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required? False
Position? Named
Accept pipeline input? False
-ProfileLocation <String>

Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)

If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials. Note that the encrypted credential file is not supported on all platforms. It will be skipped when searching for profiles on Windows Nano Server, Mac, and Linux platforms.

If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.

As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.

Required? False
Position? Named
Accept pipeline input? False
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required? False
Position? Named
Accept pipeline input? False
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required? False
Position? Named
Accept pipeline input? False
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required? False
Position? Named
Accept pipeline input? False
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required? False
Position? Named
Accept pipeline input? False
-Region <String>
The system name of the AWS region in which the operation should be invoked. For example, us-east-1, eu-west-1 etc.
Required? False
Position? Named
Accept pipeline input? False
-EndpointUrl <String>

The endpoint to make the call against.

Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.

Required? False
Position? Named
Accept pipeline input? False

Inputs

You can pipe a String object to this cmdlet for the InstanceId parameter.

Outputs

None or System.String
When you use the PassThru parameter, this cmdlet outputs the value supplied to the InstanceId parameter. Otherwise, this cmdlet does not return any output. The service response (type Amazon.EC2.Model.ModifyInstanceAttributeResponse) can be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Examples

Example 1

PS C:\> Edit-EC2InstanceAttribute -InstanceId i-12345678 -InstanceType m3.medium
This example modifies the instance type of the specified instance.

Example 2

PS C:\> Edit-EC2InstanceAttribute -InstanceId i-12345678 -SriovNetSupport "simple"
This example enables enhanced networking for the specified instance, by specifying "simple" as the value of the single root I/O virtualization (SR-IOV) network support parameter, -SriovNetSupport..

Example 3

PS C:\> Edit-EC2InstanceAttribute -InstanceId i-12345678 -Group @( "sg-12345678", "sg-45678901" )
This example modifies the security groups for the specified instance. The instance must be in a VPC. You must specify the ID of each security group, not the name.

Example 4

PS C:\> Edit-EC2InstanceAttribute -InstanceId i-12345678 -EbsOptimized $true
This example enables EBS I/O optimization for the specified instance. This feature isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.

Example 5

PS C:\> Edit-EC2InstanceAttribute -InstanceId i-12345678 -SourceDestCheck $true
This example enables source/destination checking for the specified instance. For a NAT instance to perform NAT, the value must be 'false'.

Example 6

PS C:\> Edit-EC2InstanceAttribute -InstanceId i-12345678 -DisableApiTermination $true
This example disables termination for the specified instance.

Example 7

PS C:\> Edit-EC2InstanceAttribute -InstanceId i-12345678 -InstanceInitiatedShutdownBehavior terminate
This example changes the specified instance so that it terminates when shutdown is initiated from the instance.

Supported Version

AWS Tools for PowerShell: 2.x.y.z