

Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh [SDK AWS Doc](https://github.com/awsdocs/aws-doc-sdk-examples). GitHub 

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Contoh Amazon EC2 menggunakan Alat untuk V4 PowerShell
<a name="powershell_4_ec2_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan menerapkan skenario umum dengan menggunakan Alat AWS untuk PowerShell V4 dengan Amazon EC2.

*Tindakan* merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

**Topics**
+ [Tindakan](#actions)

## Tindakan
<a name="actions"></a>

### `Add-EC2CapacityReservation`
<a name="ec2_CreateCapacityReservation_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Add-EC2CapacityReservation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat Reservasi Kapasitas baru dengan atribut yang ditentukan**  

```
Add-EC2CapacityReservation -InstanceType m4.xlarge -InstanceCount 2 -AvailabilityZone eu-west-1b -EbsOptimized True -InstancePlatform Windows
```
**Output:**  

```
AvailabilityZone       : eu-west-1b
AvailableInstanceCount : 2
CapacityReservationId  : cr-0c1f2345db6f7cdba
CreateDate             : 3/28/2019 9:29:41 AM
EbsOptimized           : True
EndDate                : 1/1/0001 12:00:00 AM
EndDateType            : unlimited
EphemeralStorage       : False
InstanceMatchCriteria  : open
InstancePlatform       : Windows
InstanceType           : m4.xlarge
State                  : active
Tags                   : {}
Tenancy                : default
TotalInstanceCount     : 2
```
+  Untuk detail API, lihat [CreateCapacityReservation](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Add-EC2InternetGateway`
<a name="ec2_AttachInternetGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Add-EC2InternetGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melampirkan gateway Internet yang ditentukan ke VPC yang ditentukan.**  

```
Add-EC2InternetGateway -InternetGatewayId igw-1a2b3c4d -VpcId vpc-12345678
```
**Contoh 2: Contoh ini membuat VPC dan gateway Internet, dan kemudian melampirkan gateway Internet ke VPC.**  

```
$vpc = New-EC2Vpc -CidrBlock 10.0.0.0/16
New-EC2InternetGateway | Add-EC2InternetGateway -VpcId $vpc.VpcId
```
+  Untuk detail API, lihat [AttachInternetGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Add-EC2NetworkInterface`
<a name="ec2_AttachNetworkInterface_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Add-EC2NetworkInterface`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melampirkan antarmuka jaringan yang ditentukan ke instance yang ditentukan.**  

```
Add-EC2NetworkInterface -NetworkInterfaceId eni-12345678 -InstanceId i-1a2b3c4d -DeviceIndex 1
```
**Output:**  

```
eni-attach-1a2b3c4d
```
+  Untuk detail API, lihat [AttachNetworkInterface](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Add-EC2Volume`
<a name="ec2_AttachVolume_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Add-EC2Volume`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melampirkan volume yang ditentukan ke instance yang ditentukan dan memaparkannya dengan nama perangkat yang ditentukan.**  

```
Add-EC2Volume -VolumeId vol-12345678 -InstanceId i-1a2b3c4d -Device /dev/sdh
```
**Output:**  

```
AttachTime          : 12/22/2015 1:53:58 AM
DeleteOnTermination : False
Device              : /dev/sdh
InstanceId          : i-1a2b3c4d
State               : attaching
VolumeId            : vol-12345678
```
+  Untuk detail API, lihat [AttachVolume](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Add-EC2VpnGateway`
<a name="ec2_AttachVpnGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Add-EC2VpnGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melampirkan gateway pribadi virtual yang ditentukan ke VPC yang ditentukan.**  

```
Add-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d -VpcId vpc-12345678
```
**Output:**  

```
State        VpcId
-----        -----
attaching    vpc-12345678
```
+  Untuk detail API, lihat [AttachVpnGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Approve-EC2VpcPeeringConnection`
<a name="ec2_AcceptVpcPeeringConnection_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Approve-EC2VpcPeeringConnection`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menyetujui pcx-1dfad234b56ff78be yang diminta VpcPeeringConnectionId **  

```
Approve-EC2VpcPeeringConnection -VpcPeeringConnectionId pcx-1dfad234b56ff78be
```
**Output:**  

```
AccepterVpcInfo        : Amazon.EC2.Model.VpcPeeringConnectionVpcInfo
ExpirationTime         : 1/1/0001 12:00:00 AM
RequesterVpcInfo       : Amazon.EC2.Model.VpcPeeringConnectionVpcInfo
Status                 : Amazon.EC2.Model.VpcPeeringConnectionStateReason
Tags                   : {}
VpcPeeringConnectionId : pcx-1dfad234b56ff78be
```
+  Untuk detail API, lihat [AcceptVpcPeeringConnection](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Confirm-EC2ProductInstance`
<a name="ec2_ConfirmProductInstance_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Confirm-EC2ProductInstance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menentukan apakah kode produk yang ditentukan dikaitkan dengan instance yang ditentukan.**  

```
Confirm-EC2ProductInstance -ProductCode 774F4FF8 -InstanceId i-12345678
```
+  Untuk detail API, lihat [ConfirmProductInstance](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Copy-EC2Image`
<a name="ec2_CopyImage_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Copy-EC2Image`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menyalin AMI yang ditentukan di wilayah 'UE (Irlandia) 'ke wilayah 'AS Barat (Oregon)'. Jika -Region tidak ditentukan, wilayah default saat ini digunakan sebagai wilayah tujuan.**  

```
Copy-EC2Image -SourceRegion eu-west-1 -SourceImageId ami-12345678 -Region us-west-2 -Name "Copy of ami-12345678"
```
**Output:**  

```
ami-87654321
```
+  Untuk detail API, lihat [CopyImage](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Copy-EC2Snapshot`
<a name="ec2_CopySnapshot_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Copy-EC2Snapshot`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menyalin snapshot yang ditentukan dari wilayah UE (Irlandia) ke wilayah AS Barat (Oregon).**  

```
Copy-EC2Snapshot -SourceRegion eu-west-1 -SourceSnapshotId snap-12345678 -Region us-west-2
```
**Contoh 2: Jika Anda menetapkan wilayah default dan menghilangkan parameter Region, wilayah tujuan default adalah wilayah default.**  

```
Set-DefaultAWSRegion us-west-2
Copy-EC2Snapshot -SourceRegion eu-west-1 -SourceSnapshotId snap-12345678
```
+  Untuk detail API, lihat [CopySnapshot](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Deny-EC2VpcPeeringConnection`
<a name="ec2_RejectVpcPeeringConnection_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Deny-EC2VpcPeeringConnection`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh di atas menolak permintaan VpcPeering permintaan id pcx-01a2b3ce45fe67eb8**  

```
Deny-EC2VpcPeeringConnection -VpcPeeringConnectionId pcx-01a2b3ce45fe67eb8
```
+  Untuk detail API, lihat [RejectVpcPeeringConnection](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Disable-EC2VgwRoutePropagation`
<a name="ec2_DisableVgwRoutePropagation_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Disable-EC2VgwRoutePropagation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menonaktifkan VGW dari menyebarkan rute secara otomatis ke tabel perutean yang ditentukan.**  

```
Disable-EC2VgwRoutePropagation -RouteTableId rtb-12345678 -GatewayId vgw-1a2b3c4d
```
+  Untuk detail API, lihat [DisableVgwRoutePropagation](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Disable-EC2VpcClassicLink`
<a name="ec2_DisableVpcClassicLink_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Disable-EC2VpcClassicLink`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menonaktifkan EC2 VpcClassicLink untuk vpc-01e23c4a5d6db78e9. Ia mengembalikan True atau False**  

```
Disable-EC2VpcClassicLink -VpcId vpc-01e23c4a5d6db78e9
```
+  Untuk detail API, lihat [DisableVpcClassicLink](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Disable-EC2VpcClassicLinkDnsSupport`
<a name="ec2_DisableVpcClassicLinkDnsSupport_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Disable-EC2VpcClassicLinkDnsSupport`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menonaktifkan dukungan ClassicLink DNS untuk vpc-0b12d3456a7e8910d**  

```
Disable-EC2VpcClassicLinkDnsSupport -VpcId vpc-0b12d3456a7e8910d
```
+  Untuk detail API, lihat [DisableVpcClassicLinkDnsSupport](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Dismount-EC2InternetGateway`
<a name="ec2_DetachInternetGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Dismount-EC2InternetGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melepaskan gateway Internet yang ditentukan dari VPC yang ditentukan.**  

```
Dismount-EC2InternetGateway -InternetGatewayId igw-1a2b3c4d -VpcId vpc-12345678
```
+  Untuk detail API, lihat [DetachInternetGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Dismount-EC2NetworkInterface`
<a name="ec2_DetachNetworkInterface_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Dismount-EC2NetworkInterface`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus lampiran yang ditentukan antara antarmuka jaringan dan instance.**  

```
Dismount-EC2NetworkInterface -AttachmentId eni-attach-1a2b3c4d -Force
```
+  Untuk detail API, lihat [DetachNetworkInterface](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Dismount-EC2Volume`
<a name="ec2_DetachVolume_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Dismount-EC2Volume`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melepaskan volume yang ditentukan.**  

```
Dismount-EC2Volume -VolumeId vol-12345678
```
**Output:**  

```
AttachTime          : 12/22/2015 1:53:58 AM
DeleteOnTermination : False
Device              : /dev/sdh
InstanceId          : i-1a2b3c4d
State               : detaching
VolumeId            : vol-12345678
```
**Contoh 2: Anda juga dapat menentukan ID instans dan nama perangkat untuk memastikan bahwa Anda melepaskan volume yang benar.**  

```
Dismount-EC2Volume -VolumeId vol-12345678 -InstanceId i-1a2b3c4d -Device /dev/sdh
```
+  Untuk detail API, lihat [DetachVolume](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Dismount-EC2VpnGateway`
<a name="ec2_DetachVpnGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Dismount-EC2VpnGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melepaskan gateway pribadi virtual yang ditentukan dari VPC yang ditentukan.**  

```
Dismount-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d -VpcId vpc-12345678
```
+  Untuk detail API, lihat [DetachVpnGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2CapacityReservation`
<a name="ec2_ModifyCapacityReservation_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2CapacityReservation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memodifikasi CapacityReservationId cr-0c1f2345db6f7cdba dengan mengubah hitungan instane menjadi 1**  

```
Edit-EC2CapacityReservation -CapacityReservationId cr-0c1f2345db6f7cdba -InstanceCount 1
```
**Output:**  

```
True
```
+  Untuk detail API, lihat [ModifyCapacityReservation](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2Host`
<a name="ec2_ModifyHosts_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2Host`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memodifikasi AutoPlacement pengaturan ke off untuk host khusus h-01e23f4cd567890f3**  

```
Edit-EC2Host -HostId h-03e09f8cd681609f3 -AutoPlacement off
```
**Output:**  

```
Successful            Unsuccessful
----------            ------------
{h-01e23f4cd567890f3} {}
```
+  Untuk detail API, lihat [ModifyHosts](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2IdFormat`
<a name="ec2_ModifyIdFormat_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2IdFormat`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memungkinkan format ID yang lebih panjang untuk jenis sumber daya yang ditentukan.**  

```
Edit-EC2IdFormat -Resource instance -UseLongId $true
```
**Contoh 2: Contoh ini menonaktifkan format ID yang lebih panjang untuk jenis sumber daya yang ditentukan.**  

```
Edit-EC2IdFormat -Resource instance -UseLongId $false
```
+  Untuk detail API, lihat [ModifyIdFormat](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2ImageAttribute`
<a name="ec2_ModifyImageAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2ImageAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memperbarui deskripsi untuk AMI yang ditentukan.**  

```
Edit-EC2ImageAttribute -ImageId ami-12345678 -Description "New description"
```
**Contoh 2: Contoh ini membuat AMI menjadi publik (misalnya, jadi siapa pun Akun AWS dapat menggunakannya).**  

```
Edit-EC2ImageAttribute -ImageId ami-12345678 -Attribute launchPermission -OperationType add -UserGroup all
```
**Contoh 3: Contoh ini menjadikan AMI pribadi (misalnya, sehingga hanya Anda sebagai pemilik yang dapat menggunakannya).**  

```
Edit-EC2ImageAttribute -ImageId ami-12345678 -Attribute launchPermission -OperationType remove -UserGroup all
```
**Contoh 4: Contoh ini memberikan izin peluncuran ke yang ditentukan Akun AWS.**  

```
Edit-EC2ImageAttribute -ImageId ami-12345678 -Attribute launchPermission -OperationType add -UserId 111122223333
```
**Contoh 5: Contoh ini menghapus izin peluncuran dari yang ditentukan Akun AWS.**  

```
Edit-EC2ImageAttribute -ImageId ami-12345678 -Attribute launchPermission -OperationType remove -UserId 111122223333
```
+  Untuk detail API, lihat [ModifyImageAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2InstanceAttribute`
<a name="ec2_ModifyInstanceAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2InstanceAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memodifikasi jenis instance dari instance yang ditentukan.**  

```
Edit-EC2InstanceAttribute -InstanceId i-12345678 -InstanceType m3.medium
```
**Contoh 2: Contoh ini memungkinkan peningkatan jaringan untuk instance tertentu, dengan menentukan “sederhana” sebagai nilai dari parameter dukungan jaringan I/O virtualisasi root tunggal (SR-IOV), -.. SriovNetSupport**  

```
Edit-EC2InstanceAttribute -InstanceId i-12345678 -SriovNetSupport "simple"
```
**Contoh 3: Contoh ini memodifikasi grup keamanan untuk instance tertentu. Instans harus dalam VPC. Anda harus menentukan ID dari setiap grup keamanan, bukan nama.**  

```
Edit-EC2InstanceAttribute -InstanceId i-12345678 -Group @( "sg-12345678", "sg-45678901" )
```
**Contoh 4: Contoh ini memungkinkan I/O optimasi EBS untuk instance tertentu. Fitur ini tidak tersedia dengan semua jenis instance. Biaya penggunaan tambahan berlaku saat menggunakan instans yang dioptimalkan EBS.**  

```
Edit-EC2InstanceAttribute -InstanceId i-12345678 -EbsOptimized $true
```
**Contoh 5: Contoh ini memungkinkan source/destination pemeriksaan untuk contoh yang ditentukan. Untuk instance NAT untuk melakukan NAT, nilainya harus 'salah'.**  

```
Edit-EC2InstanceAttribute -InstanceId i-12345678 -SourceDestCheck $true
```
**Contoh 6: Contoh ini menonaktifkan penghentian untuk contoh yang ditentukan.**  

```
Edit-EC2InstanceAttribute -InstanceId i-12345678 -DisableApiTermination $true
```
**Contoh 7: Contoh ini mengubah instance tertentu sehingga berakhir ketika shutdown dimulai dari instance.**  

```
Edit-EC2InstanceAttribute -InstanceId i-12345678 -InstanceInitiatedShutdownBehavior terminate
```
+  Untuk detail API, lihat [ModifyInstanceAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2InstanceCreditSpecification`
<a name="ec2_ModifyInstanceCreditSpecification_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2InstanceCreditSpecification`.

**Alat untuk PowerShell V4**  
**Contoh 1: Ini memungkinkan kredit tak terbatas T2 misalnya i-01234567890abcdef.**  

```
$Credit = New-Object -TypeName Amazon.EC2.Model.InstanceCreditSpecificationRequest
$Credit.InstanceId = "i-01234567890abcdef"
$Credit.CpuCredits = "unlimited"
Edit-EC2InstanceCreditSpecification -InstanceCreditSpecification $Credit
```
+  Untuk detail API, lihat [ModifyInstanceCreditSpecification](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2NetworkInterfaceAttribute`
<a name="ec2_ModifyNetworkInterfaceAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2NetworkInterfaceAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memodifikasi antarmuka jaringan yang ditentukan sehingga lampiran yang ditentukan dihapus pada penghentian.**  

```
Edit-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-1a2b3c4d -Attachment_AttachmentId eni-attach-1a2b3c4d -Attachment_DeleteOnTermination $true
```
**Contoh 2: Contoh ini memodifikasi deskripsi antarmuka jaringan yang ditentukan.**  

```
Edit-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-1a2b3c4d -Description "my description"
```
**Contoh 3: Contoh ini memodifikasi grup keamanan untuk antarmuka jaringan yang ditentukan.**  

```
Edit-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-1a2b3c4d -Groups sg-1a2b3c4d
```
**Contoh 4: Contoh ini menonaktifkan source/destination pemeriksaan antarmuka jaringan yang ditentukan.**  

```
Edit-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-1a2b3c4d -SourceDestCheck $false
```
+  Untuk detail API, lihat [ModifyNetworkInterfaceAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2ReservedInstance`
<a name="ec2_ModifyReservedInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2ReservedInstance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memodifikasi Availability Zone, jumlah instans, dan platform untuk instans Cadangan yang ditentukan.**  

```
$config = New-Object Amazon.EC2.Model.ReservedInstancesConfiguration
$config.AvailabilityZone = "us-west-2a"
$config.InstanceCount = 1
$config.Platform = "EC2-VPC"

Edit-EC2ReservedInstance `
-ReservedInstancesId @("FE32132D-70D5-4795-B400-AE435EXAMPLE", "0CC556F3-7AB8-4C00-B0E5-98666EXAMPLE") `
-TargetConfiguration $config
```
+  Untuk detail API, lihat [ModifyReservedInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2SnapshotAttribute`
<a name="ec2_ModifySnapshotAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2SnapshotAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat snapshot yang ditentukan publik dengan menyetel CreateVolumePermission atributnya.**  

```
Edit-EC2SnapshotAttribute -SnapshotId snap-12345678 -Attribute CreateVolumePermission -OperationType Add -GroupName all
```
+  Untuk detail API, lihat [ModifySnapshotAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2SpotFleetRequest`
<a name="ec2_ModifySpotFleetRequest_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2SpotFleetRequest`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memperbarui kapasitas target permintaan armada Spot yang ditentukan.**  

```
Edit-EC2SpotFleetRequest -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -TargetCapacity 10
```
**Output:**  

```
True
```
+  Untuk detail API, lihat [ModifySpotFleetRequest](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2SubnetAttribute`
<a name="ec2_ModifySubnetAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2SubnetAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memungkinkan pengalamatan IP publik untuk subnet yang ditentukan.**  

```
Edit-EC2SubnetAttribute -SubnetId subnet-1a2b3c4d -MapPublicIpOnLaunch $true
```
**Contoh 2: Contoh ini menonaktifkan pengalamatan IP publik untuk subnet yang ditentukan.**  

```
Edit-EC2SubnetAttribute -SubnetId subnet-1a2b3c4d -MapPublicIpOnLaunch $false
```
+  Untuk detail API, lihat [ModifySubnetAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2VolumeAttribute`
<a name="ec2_ModifyVolumeAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2VolumeAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memodifikasi atribut tertentu dari volume yang ditentukan. I/O operasi untuk volume secara otomatis dilanjutkan setelah ditangguhkan karena data yang berpotensi tidak konsisten**.  

```
Edit-EC2VolumeAttribute -VolumeId vol-12345678 -AutoEnableIO $true
```
+  Untuk detail API, lihat [ModifyVolumeAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Edit-EC2VpcAttribute`
<a name="ec2_ModifyVpcAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Edit-EC2VpcAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memungkinkan dukungan untuk nama host DNS untuk VPC yang ditentukan.**  

```
Edit-EC2VpcAttribute -VpcId vpc-12345678 -EnableDnsHostnames $true
```
**Contoh 2: Contoh ini menonaktifkan dukungan untuk nama host DNS untuk VPC yang ditentukan.**  

```
Edit-EC2VpcAttribute -VpcId vpc-12345678 -EnableDnsHostnames $false
```
**Contoh 3: Contoh ini memungkinkan dukungan untuk resolusi DNS untuk VPC yang ditentukan.**  

```
Edit-EC2VpcAttribute -VpcId vpc-12345678 -EnableDnsSupport $true
```
**Contoh 4: Contoh ini menonaktifkan dukungan untuk resolusi DNS untuk VPC yang ditentukan.**  

```
Edit-EC2VpcAttribute -VpcId vpc-12345678 -EnableDnsSupport $false
```
+  Untuk detail API, lihat [ModifyVpcAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Enable-EC2VgwRoutePropagation`
<a name="ec2_EnableVgwRoutePropagation_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Enable-EC2VgwRoutePropagation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memungkinkan VGW yang ditentukan untuk menyebarkan rute secara otomatis ke tabel perutean yang ditentukan.**  

```
Enable-EC2VgwRoutePropagation -RouteTableId rtb-12345678 -GatewayId vgw-1a2b3c4d
```
+  Untuk detail API, lihat [EnableVgwRoutePropagation](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Enable-EC2VolumeIO`
<a name="ec2_EnableVolumeIo_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Enable-EC2VolumeIO`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memungkinkan I/O operasi untuk volume yang ditentukan, jika I/O operasi dinonaktifkan.**  

```
Enable-EC2VolumeIO -VolumeId vol-12345678
```
+  Untuk detail API, lihat [EnableVolumeIo](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Enable-EC2VpcClassicLink`
<a name="ec2_EnableVpcClassicLink_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Enable-EC2VpcClassicLink`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memungkinkan VPC vpc-0123456b789b0d12f untuk ClassicLink**  

```
Enable-EC2VpcClassicLink -VpcId vpc-0123456b789b0d12f
```
**Output:**  

```
True
```
+  Untuk detail API, lihat [EnableVpcClassicLink](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Enable-EC2VpcClassicLinkDnsSupport`
<a name="ec2_EnableVpcClassicLinkDnsSupport_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Enable-EC2VpcClassicLinkDnsSupport`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memungkinkan vpc-0b12d3456a7e8910d untuk mendukung resolusi nama host DNS untuk ClassicLink**  

```
Enable-EC2VpcClassicLinkDnsSupport -VpcId vpc-0b12d3456a7e8910d -Region eu-west-1
```
+  Untuk detail API, lihat [EnableVpcClassicLinkDnsSupport](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2AccountAttribute`
<a name="ec2_DescribeAccountAttributes_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2AccountAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan apakah Anda dapat meluncurkan instance ke EC2-Classic dan EC2-VPC di wilayah tersebut, atau hanya ke EC2-VPC.**  

```
(Get-EC2AccountAttribute -AttributeName supported-platforms).AttributeValues
```
**Output:**  

```
AttributeValue
--------------
EC2
VPC
```
**Contoh 2: Contoh ini menjelaskan VPC default Anda, atau 'tidak ada' jika Anda tidak memiliki VPC default di wilayah tersebut.**  

```
(Get-EC2AccountAttribute -AttributeName default-vpc).AttributeValues
```
**Output:**  

```
AttributeValue
--------------
vpc-12345678
```
**Contoh 3: Contoh ini menjelaskan jumlah maksimum instans On-Demand yang dapat Anda jalankan.**  

```
(Get-EC2AccountAttribute -AttributeName max-instances).AttributeValues
```
**Output:**  

```
AttributeValue
--------------
20
```
+  Untuk detail API, lihat [DescribeAccountAttributes](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Address`
<a name="ec2_DescribeAddresses_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Address`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan alamat IP Elastis yang ditentukan untuk instance di EC2-Classic.**  

```
Get-EC2Address -AllocationId eipalloc-12345678
```
**Output:**  

```
AllocationId            : eipalloc-12345678
AssociationId           : eipassoc-12345678
Domain                  : vpc
InstanceId              : i-87654321
NetworkInterfaceId      : eni-12345678
NetworkInterfaceOwnerId : 12345678
PrivateIpAddress        : 10.0.2.172
PublicIp                : 198.51.100.2
```
**Contoh 2: Contoh ini menjelaskan alamat IP Elastis Anda untuk instance di VPC. Sintaks ini membutuhkan PowerShell versi 3 atau yang lebih baru.**  

```
Get-EC2Address -Filter @{ Name="domain";Values="vpc" }
```
**Contoh 3: Contoh ini menjelaskan alamat IP Elastis yang ditentukan untuk instance di EC2-Classic.**  

```
Get-EC2Address -PublicIp 203.0.113.17
```
**Output:**  

```
AllocationId            :
AssociationId           :
Domain                  : standard
InstanceId              : i-12345678
NetworkInterfaceId      :
NetworkInterfaceOwnerId :
PrivateIpAddress        :
PublicIp                : 203.0.113.17
```
**Contoh 4: Contoh ini menjelaskan alamat IP Elastis Anda untuk instance di EC2-Classic. Sintaks ini membutuhkan PowerShell versi 3 atau yang lebih baru.**  

```
Get-EC2Address -Filter @{ Name="domain";Values="standard" }
```
**Contoh 5: Contoh ini menjelaskan semua alamat IP Elastis Anda.**  

```
Get-EC2Address
```
**Contoh 6: Contoh ini mengembalikan IP publik dan pribadi untuk id contoh yang disediakan dalam filter**  

```
Get-EC2Address -Region eu-west-1 -Filter @{Name="instance-id";Values="i-0c12d3f4f567ffb89"} | Select-Object PrivateIpAddress, PublicIp
```
**Output:**  

```
PrivateIpAddress PublicIp
---------------- --------
10.0.0.99        63.36.5.227
```
**Contoh 7: Contoh ini mengambil semua Elastic IPs dengan id alokasi, id asosiasi dan id instans**  

```
Get-EC2Address -Region eu-west-1 | Select-Object InstanceId, AssociationId, AllocationId, PublicIp
```
**Output:**  

```
InstanceId          AssociationId              AllocationId               PublicIp
----------          -------------              ------------               --------
                                               eipalloc-012e3b456789e1fad 17.212.120.178
i-0c123dfd3415bac67 eipassoc-0e123456bb7890bdb eipalloc-01cd23ebf45f7890c 17.212.124.77
                                               eipalloc-012345678eeabcfad 17.212.225.7
i-0123d405c67e89a0c eipassoc-0c123b456783966ba eipalloc-0123cdd456a8f7892 37.216.52.173
i-0f1bf2f34c5678d09 eipassoc-0e12934568a952d96 eipalloc-0e1c23e4d5e6789e4 37.218.222.278
i-012e3cb4df567e8aa eipassoc-0d1b2fa4d67d03810 eipalloc-0123f456f78a01b58 37.210.82.27
i-0123bcf4b567890e1 eipassoc-01d2345f678903fb1 eipalloc-0e1db23cfef5c45c7 37.215.222.270
```
**Contoh 8: Contoh ini mengambil daftar alamat IP EC2 yang cocok dengan kunci tag 'Kategori' dengan nilai 'Prod'**  

```
Get-EC2Address -Filter @{Name="tag:Category";Values="Prod"}
```
**Output:**  

```
AllocationId            : eipalloc-0123f456f81a01b58
AssociationId           : eipassoc-0d1b23a456d103810
CustomerOwnedIp         :
CustomerOwnedIpv4Pool   :
Domain                  : vpc
InstanceId              : i-012e3cb4df567e1aa
NetworkBorderGroup      : eu-west-1
NetworkInterfaceId      : eni-0123f41d5a60d5f40
NetworkInterfaceOwnerId : 123456789012
PrivateIpAddress        : 192.168.1.84
PublicIp                : 34.250.81.29
PublicIpv4Pool          : amazon
Tags                    : {Category, Name}
```
+  Untuk detail API, lihat [DescribeAddresses](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2AvailabilityZone`
<a name="ec2_DescribeAvailabilityZones_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2AvailabilityZone`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan Availability Zone untuk wilayah saat ini yang tersedia untuk Anda.**  

```
Get-EC2AvailabilityZone
```
**Output:**  

```
Messages    RegionName    State        ZoneName
--------    ----------    -----        --------
{}          us-west-2     available    us-west-2a
{}          us-west-2     available    us-west-2b
{}          us-west-2     available    us-west-2c
```
**Contoh 2: Contoh ini menjelaskan Availability Zone yang berada dalam keadaan terganggu. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
Get-EC2AvailabilityZone -Filter @{ Name="state";Values="impaired" }
```
**Contoh 3: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat filter.**  

```
$filter = New-Object Amazon.EC2.Model.Filter
$filter.Name = "state"
$filter.Values = "impaired"

Get-EC2AvailabilityZone -Filter $filter
```
+  Untuk detail API, lihat [DescribeAvailabilityZones](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2BundleTask`
<a name="ec2_DescribeBundleTasks_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2BundleTask`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan tugas bundel yang ditentukan.**  

```
Get-EC2BundleTask -BundleId bun-12345678
```
**Contoh 2: Contoh ini menjelaskan tugas bundel yang statusnya 'lengkap' atau 'gagal'.**  

```
$filter = New-Object Amazon.EC2.Model.Filter
$filter.Name = "state"
$filter.Values = @( "complete", "failed" )

Get-EC2BundleTask -Filter $filter
```
+  Untuk detail API, lihat [DescribeBundleTasks](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2CapacityReservation`
<a name="ec2_DescribeCapacityReservations_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2CapacityReservation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan satu atau beberapa Reservasi Kapasitas Anda untuk wilayah tersebut**  

```
Get-EC2CapacityReservation -Region eu-west-1
```
**Output:**  

```
AvailabilityZone       : eu-west-1b
AvailableInstanceCount : 2
CapacityReservationId  : cr-0c1f2345db6f7cdba
CreateDate             : 3/28/2019 9:29:41 AM
EbsOptimized           : True
EndDate                : 1/1/0001 12:00:00 AM
EndDateType            : unlimited
EphemeralStorage       : False
InstanceMatchCriteria  : open
InstancePlatform       : Windows
InstanceType           : m4.xlarge
State                  : active
Tags                   : {}
Tenancy                : default
TotalInstanceCount     : 2
```
+  Untuk detail API, lihat [DescribeCapacityReservations](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2ConsoleOutput`
<a name="ec2_GetConsoleOutput_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2ConsoleOutput`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mendapatkan output konsol untuk instance Linux yang ditentukan. Output konsol dikodekan.**  

```
Get-EC2ConsoleOutput -InstanceId i-0e19abcd47c123456
```
**Output:**  

```
InstanceId          Output
----------          ------
i-0e194d3c47c123637 WyAgICAwLjAwMDAwMF0gQ29tbW...bGU9dHR5UzAgc2Vs
```
**Contoh 2: Contoh ini menyimpan output konsol yang dikodekan dalam variabel dan kemudian menerjemahkannya.**  

```
$Output_encoded = (Get-EC2ConsoleOutput -InstanceId i-0e19abcd47c123456).Output
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Output_encoded))
```
+  Untuk detail API, lihat [GetConsoleOutput](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2CustomerGateway`
<a name="ec2_DescribeCustomerGateways_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2CustomerGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan gateway pelanggan yang ditentukan.**  

```
Get-EC2CustomerGateway -CustomerGatewayId cgw-1a2b3c4d
```
**Output:**  

```
BgpAsn            : 65534
CustomerGatewayId : cgw-1a2b3c4d
IpAddress         : 203.0.113.12
State             : available
Tags              : {}
Type              : ipsec.1
```
**Contoh 2: Contoh ini menjelaskan gateway pelanggan yang statusnya tertunda atau tersedia.**  

```
$filter = New-Object Amazon.EC2.Model.Filter
$filter.Name = "state"
$filter.Values = @( "pending", "available" )

Get-EC2CustomerGateway -Filter $filter
```
**Contoh 3: Contoh ini menjelaskan semua gateway pelanggan Anda.**  

```
Get-EC2CustomerGateway
```
+  Untuk detail API, lihat [DescribeCustomerGateways](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2DhcpOption`
<a name="ec2_DescribeDhcpOptions_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2DhcpOption`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mencantumkan set opsi DHCP Anda.**  

```
Get-EC2DhcpOption
```
**Output:**  

```
DhcpConfigurations                    DhcpOptionsId    Tag
------------------                    -------------    ---
{domain-name, domain-name-servers}    dopt-1a2b3c4d    {}
{domain-name, domain-name-servers}    dopt-2a3b4c5d    {}
{domain-name-servers}                 dopt-3a4b5c6d    {}
```
**Contoh 2: Contoh ini mendapatkan detail konfigurasi untuk set opsi DHCP yang ditentukan.**  

```
(Get-EC2DhcpOption -DhcpOptionsId dopt-1a2b3c4d).DhcpConfigurations
```
**Output:**  

```
Key                    Values
---                    ------
domain-name            {abc.local}
domain-name-servers    {10.0.0.101, 10.0.0.102}
```
+  Untuk detail API, lihat [DescribeDhcpOptions](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2FlowLog`
<a name="ec2_DescribeFlowLogs_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2FlowLog`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan satu atau lebih flow log dengan tipe tujuan log 's3'**  

```
Get-EC2FlowLog -Filter @{Name="log-destination-type";Values="s3"}
```
**Output:**  

```
CreationTime             : 2/25/2019 9:07:36 PM
DeliverLogsErrorMessage  :
DeliverLogsPermissionArn :
DeliverLogsStatus        : SUCCESS
FlowLogId                : fl-01b2e3d45f67f8901
FlowLogStatus            : ACTIVE
LogDestination           : arn:aws:s3:::amzn-s3-demo-bucket-dd-tata
LogDestinationType       : s3
LogGroupName             :
ResourceId               : eni-01d2dda3456b7e890
TrafficType              : ALL
```
+  Untuk detail API, lihat [DescribeFlowLogs](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Host`
<a name="ec2_DescribeHosts_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Host`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengembalikan rincian host EC2**  

```
Get-EC2Host
```
**Output:**  

```
AllocationTime    : 3/23/2019 4:55:22 PM
AutoPlacement     : off
AvailabilityZone  : eu-west-1b
AvailableCapacity : Amazon.EC2.Model.AvailableCapacity
ClientToken       :
HostId            : h-01e23f4cd567890f1
HostProperties    : Amazon.EC2.Model.HostProperties
HostReservationId :
Instances         : {}
ReleaseTime       : 1/1/0001 12:00:00 AM
State             : available
Tags              : {}
```
**Contoh 2: Contoh ini menanyakan host AvailableInstanceCapacity h-01e23f4cd567899f1**  

```
Get-EC2Host -HostId h-01e23f4cd567899f1 | Select-Object -ExpandProperty AvailableCapacity | Select-Object -expand AvailableInstanceCapacity
```
**Output:**  

```
AvailableCapacity InstanceType TotalCapacity
----------------- ------------ -------------
11                m4.xlarge    11
```
+  Untuk detail API, lihat [DescribeHosts](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2HostReservationOffering`
<a name="ec2_DescribeHostReservationOfferings_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2HostReservationOffering`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan reservasi Host Khusus yang tersedia untuk dibeli untuk filter yang diberikan 'instance-family' di mana '' PaymentOption NoUpfront**  

```
Get-EC2HostReservationOffering -Filter @{Name="instance-family";Values="m4"} | Where-Object PaymentOption -eq NoUpfront
```
**Output:**  

```
CurrencyCode   :
Duration       : 94608000
HourlyPrice    : 1.307
InstanceFamily : m4
OfferingId     : hro-0c1f234567890d9ab
PaymentOption  : NoUpfront
UpfrontPrice   : 0.000

CurrencyCode   :
Duration       : 31536000
HourlyPrice    : 1.830
InstanceFamily : m4
OfferingId     : hro-04ad12aaaf34b5a67
PaymentOption  : NoUpfront
UpfrontPrice   : 0.000
```
+  Untuk detail API, lihat [DescribeHostReservationOfferings](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2HostReservationPurchasePreview`
<a name="ec2_GetHostReservationPurchasePreview_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2HostReservationPurchasePreview`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menampilkan pratinjau pembelian reservasi dengan konfigurasi yang cocok dengan Host Khusus Anda h-01e23f4cd567890f1**  

```
Get-EC2HostReservationPurchasePreview -OfferingId hro-0c1f23456789d0ab -HostIdSet h-01e23f4cd567890f1
```
**Output:**  

```
CurrencyCode Purchase TotalHourlyPrice TotalUpfrontPrice
------------ -------- ---------------- -----------------
             {}       1.307            0.000
```
+  Untuk detail API, lihat [GetHostReservationPurchasePreview](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2IdFormat`
<a name="ec2_DescribeIdFormat_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2IdFormat`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan format ID untuk jenis sumber daya yang ditentukan.**  

```
Get-EC2IdFormat -Resource instance
```
**Output:**  

```
Resource       UseLongIds
--------       ----------
instance       False
```
**Contoh 2: Contoh ini menjelaskan format ID untuk semua jenis sumber daya yang mendukung lebih lama IDs.**  

```
Get-EC2IdFormat
```
**Output:**  

```
Resource       UseLongIds
--------       ----------
reservation    False
instance       False
```
+  Untuk detail API, lihat [DescribeIdFormat](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2IdentityIdFormat`
<a name="ec2_DescribeIdentityIdFormat_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2IdentityIdFormat`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengembalikan format ID untuk sumber 'image' untuk peran yang diberikan**  

```
Get-EC2IdentityIdFormat -PrincipalArn arn:aws:iam::123456789511:role/JDBC -Resource image
```
**Output:**  

```
Deadline             Resource UseLongIds
--------             -------- ----------
8/2/2018 11:30:00 PM image    True
```
+  Untuk detail API, lihat [DescribeIdentityIdFormat](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Image`
<a name="ec2_DescribeImages_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Image`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan AMI yang ditentukan.**  

```
Get-EC2Image -ImageId ami-12345678
```
**Output:**  

```
Architecture        : x86_64
BlockDeviceMappings : {/dev/xvda}
CreationDate        : 2014-10-20T00:56:28.000Z
Description         : My image
Hypervisor          : xen
ImageId             : ami-12345678
ImageLocation       : 123456789012/my-image
ImageOwnerAlias     :
ImageType           : machine
KernelId            :
Name                : my-image
OwnerId             : 123456789012
Platform            :
ProductCodes        : {}
Public              : False
RamdiskId           :
RootDeviceName      : /dev/xvda
RootDeviceType      : ebs
SriovNetSupport     : simple
State               : available
StateReason         :
Tags                : {Name}
VirtualizationType  : hvm
```
**Contoh 2: Contoh ini menggambarkan AMIs yang Anda miliki.**  

```
Get-EC2Image -owner self
```
**Contoh 3: Contoh ini menjelaskan publik AMIs yang menjalankan Microsoft Windows Server.**  

```
Get-EC2Image -Filter @{ Name="platform"; Values="windows" }
```
**Contoh 4: Contoh ini menjelaskan semua publik AMIs di wilayah 'us-west-2'.**  

```
Get-EC2Image -Region us-west-2
```
+  Untuk detail API, lihat [DescribeImages](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2ImageAttribute`
<a name="ec2_DescribeImageAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2ImageAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mendapatkan deskripsi untuk AMI yang ditentukan.**  

```
Get-EC2ImageAttribute -ImageId ami-12345678 -Attribute description
```
**Output:**  

```
BlockDeviceMappings : {}
Description         : My image description
ImageId             : ami-12345678
KernelId            :
LaunchPermissions   : {}
ProductCodes        : {}
RamdiskId           :
SriovNetSupport     :
```
**Contoh 2: Contoh ini mendapatkan izin peluncuran untuk AMI yang ditentukan.**  

```
Get-EC2ImageAttribute -ImageId ami-12345678 -Attribute launchPermission
```
**Output:**  

```
BlockDeviceMappings : {}
Description         :
ImageId             : ami-12345678
KernelId            :
LaunchPermissions   : {all}
ProductCodes        : {}
RamdiskId           :
SriovNetSupport     :
```
**Contoh 3: Contoh ini menguji apakah jaringan yang ditingkatkan diaktifkan.**  

```
Get-EC2ImageAttribute -ImageId ami-12345678 -Attribute sriovNetSupport
```
**Output:**  

```
BlockDeviceMappings : {}
Description         :
ImageId             : ami-12345678
KernelId            :
LaunchPermissions   : {}
ProductCodes        : {}
RamdiskId           :
SriovNetSupport     : simple
```
+  Untuk detail API, lihat [DescribeImageAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2ImageByName`
<a name="ec2_Get-EC2ImageByName_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2ImageByName`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan kumpulan lengkap nama filter yang saat ini didukung.**  

```
Get-EC2ImageByName
```
**Output:**  

```
WINDOWS_2016_BASE
WINDOWS_2016_NANO
WINDOWS_2016_CORE
WINDOWS_2016_CONTAINER
WINDOWS_2016_SQL_SERVER_ENTERPRISE_2016
WINDOWS_2016_SQL_SERVER_STANDARD_2016
WINDOWS_2016_SQL_SERVER_WEB_2016
WINDOWS_2016_SQL_SERVER_EXPRESS_2016
WINDOWS_2012R2_BASE
WINDOWS_2012R2_CORE
WINDOWS_2012R2_SQL_SERVER_EXPRESS_2016
WINDOWS_2012R2_SQL_SERVER_STANDARD_2016
WINDOWS_2012R2_SQL_SERVER_WEB_2016
WINDOWS_2012R2_SQL_SERVER_EXPRESS_2014
WINDOWS_2012R2_SQL_SERVER_STANDARD_2014
WINDOWS_2012R2_SQL_SERVER_WEB_2014
WINDOWS_2012_BASE
WINDOWS_2012_SQL_SERVER_EXPRESS_2014
WINDOWS_2012_SQL_SERVER_STANDARD_2014
WINDOWS_2012_SQL_SERVER_WEB_2014
WINDOWS_2012_SQL_SERVER_EXPRESS_2012
WINDOWS_2012_SQL_SERVER_STANDARD_2012
WINDOWS_2012_SQL_SERVER_WEB_2012
WINDOWS_2012_SQL_SERVER_EXPRESS_2008
WINDOWS_2012_SQL_SERVER_STANDARD_2008
WINDOWS_2012_SQL_SERVER_WEB_2008
WINDOWS_2008R2_BASE
WINDOWS_2008R2_SQL_SERVER_EXPRESS_2012
WINDOWS_2008R2_SQL_SERVER_STANDARD_2012
WINDOWS_2008R2_SQL_SERVER_WEB_2012
WINDOWS_2008R2_SQL_SERVER_EXPRESS_2008
WINDOWS_2008R2_SQL_SERVER_STANDARD_2008
WINDOWS_2008R2_SQL_SERVER_WEB_2008
WINDOWS_2008RTM_BASE
WINDOWS_2008RTM_SQL_SERVER_EXPRESS_2008
WINDOWS_2008RTM_SQL_SERVER_STANDARD_2008
WINDOWS_2008_BEANSTALK_IIS75
WINDOWS_2012_BEANSTALK_IIS8
VPC_NAT
```
**Contoh 2: Contoh ini menjelaskan AMI yang ditentukan. Menggunakan perintah ini untuk menemukan AMI sangat membantu karena AWS merilis Windows baru AMIs dengan pembaruan terbaru setiap bulan. Anda dapat menentukan 'ImageId' New-EC2Instance untuk meluncurkan instance menggunakan AMI saat ini untuk filter yang ditentukan.**  

```
Get-EC2ImageByName -Names WINDOWS_2016_BASE
```
**Output:**  

```
Architecture        : x86_64
BlockDeviceMappings : {/dev/sda1, xvdca, xvdcb, xvdcc...}
CreationDate        : yyyy.mm.ddThh:mm:ss.000Z
Description         : Microsoft Windows Server 2016 with Desktop Experience Locale English AMI provided by Amazon
Hypervisor          : xen
ImageId             : ami-xxxxxxxx
ImageLocation       : amazon/Windows_Server-2016-English-Full-Base-yyyy.mm.dd
ImageOwnerAlias     : amazon
ImageType           : machine
KernelId            :
Name                : Windows_Server-2016-English-Full-Base-yyyy.mm.dd
OwnerId             : 801119661308
Platform            : Windows
ProductCodes        : {}
Public              : True
RamdiskId           :
RootDeviceName      : /dev/sda1
RootDeviceType      : ebs
SriovNetSupport     : simple
State               : available
StateReason         :
Tags                : {}
VirtualizationType  : hvm
```
+  Untuk detail API, lihat [Get-EC2ImageByName](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2ImportImageTask`
<a name="ec2_DescribeImportImageTasks_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2ImportImageTask`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan tugas impor gambar yang ditentukan.**  

```
Get-EC2ImportImageTask -ImportTaskId import-ami-hgfedcba
```
**Output:**  

```
Architecture    : x86_64
Description     : Windows Image 2
Hypervisor      :
ImageId         : ami-1a2b3c4d
ImportTaskId    : import-ami-hgfedcba
LicenseType     : AWS
Platform        : Windows
Progress        :
SnapshotDetails : {/dev/sda1}
Status          : completed
StatusMessage   :
```
**Contoh 2: Contoh ini menjelaskan semua tugas impor gambar Anda.**  

```
Get-EC2ImportImageTask
```
**Output:**  

```
Architecture    :
Description     : Windows Image 1
Hypervisor      :
ImageId         :
ImportTaskId    : import-ami-abcdefgh
LicenseType     : AWS
Platform        : Windows
Progress        :
SnapshotDetails : {}
Status          : deleted
StatusMessage   : User initiated task cancelation

Architecture    : x86_64
Description     : Windows Image 2
Hypervisor      :
ImageId         : ami-1a2b3c4d
ImportTaskId    : import-ami-hgfedcba
LicenseType     : AWS
Platform        : Windows
Progress        :
SnapshotDetails : {/dev/sda1}
Status          : completed
StatusMessage   :
```
+  Untuk detail API, lihat [DescribeImportImageTasks](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2ImportSnapshotTask`
<a name="ec2_DescribeImportSnapshotTasks_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2ImportSnapshotTask`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan tugas impor snapshot yang ditentukan.**  

```
Get-EC2ImportSnapshotTask -ImportTaskId import-snap-abcdefgh
```
**Output:**  

```
Description             ImportTaskId               SnapshotTaskDetail                                                          
-----------------       --------------------       ------------------                                                          
Disk Image Import 1     import-snap-abcdefgh       Amazon.EC2.Model.SnapshotTaskDetail
```
**Contoh 2: Contoh ini menjelaskan semua tugas impor snapshot Anda.**  

```
Get-EC2ImportSnapshotTask
```
**Output:**  

```
Description             ImportTaskId               SnapshotTaskDetail                                                          
-----------------       --------------------       ------------------                                                          
Disk Image Import 1     import-snap-abcdefgh       Amazon.EC2.Model.SnapshotTaskDetail 
Disk Image Import 2     import-snap-hgfedcba       Amazon.EC2.Model.SnapshotTaskDetail
```
+  Untuk detail API, lihat [DescribeImportSnapshotTasks](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Instance`
<a name="ec2_DescribeInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Instance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan contoh yang ditentukan.**  

```
(Get-EC2Instance -InstanceId i-12345678).Instances
```
**Output:**  

```
AmiLaunchIndex        : 0
Architecture          : x86_64
BlockDeviceMappings   : {/dev/sda1}
ClientToken           : TleEy1448154045270
EbsOptimized          : False
Hypervisor            : xen
IamInstanceProfile    : Amazon.EC2.Model.IamInstanceProfile
ImageId               : ami-12345678
InstanceId            : i-12345678
InstanceLifecycle     :
InstanceType          : t2.micro
KernelId              :
KeyName               : my-key-pair
LaunchTime            : 12/4/2015 4:44:40 PM
Monitoring            : Amazon.EC2.Model.Monitoring
NetworkInterfaces     : {ip-10-0-2-172.us-west-2.compute.internal}
Placement             : Amazon.EC2.Model.Placement
Platform              : Windows
PrivateDnsName        : ip-10-0-2-172.us-west-2.compute.internal
PrivateIpAddress      : 10.0.2.172
ProductCodes          : {}
PublicDnsName         : 
PublicIpAddress       : 
RamdiskId             :
RootDeviceName        : /dev/sda1
RootDeviceType        : ebs
SecurityGroups        : {default}
SourceDestCheck       : True
SpotInstanceRequestId :
SriovNetSupport       :
State                 : Amazon.EC2.Model.InstanceState
StateReason           :
StateTransitionReason :
SubnetId              : subnet-12345678
Tags                  : {Name}
VirtualizationType    : hvm
VpcId                 : vpc-12345678
```
**Contoh 2: Contoh ini menjelaskan semua instans Anda di wilayah saat ini, dikelompokkan berdasarkan reservasi. Untuk melihat detail instance, perluas koleksi Instances dalam setiap objek reservasi.**  

```
Get-EC2Instance
```
**Output:**  

```
GroupNames    : {}
Groups        : {}
Instances     : {}
OwnerId       : 123456789012
RequesterId   : 226008221399
ReservationId : r-c5df370c

GroupNames    : {}
Groups        : {}
Instances     : {}
OwnerId       : 123456789012
RequesterId   : 854251627541
ReservationId : r-63e65bab
...
```
**Contoh 3: Contoh ini menggambarkan penggunaan filter untuk kueri instans EC2 di subnet tertentu dari VPC.**  

```
(Get-EC2Instance -Filter @{Name="vpc-id";Values="vpc-1a2bc34d"},@{Name="subnet-id";Values="subnet-1a2b3c4d"}).Instances
```
**Output:**  

```
InstanceId          InstanceType Platform PrivateIpAddress PublicIpAddress SecurityGroups SubnetId        VpcId
----------          ------------ -------- ---------------- --------------- -------------- --------        -----
i-01af...82cf180e19 t2.medium    Windows  10.0.0.98                        ...            subnet-1a2b3c4d vpc-1a2b3c4d
i-0374...7e9d5b0c45 t2.xlarge    Windows  10.0.0.53                        ...            subnet-1a2b3c4d vpc-1a2b3c4d
```
**Contoh 4: Contoh ini menggambarkan penggunaan filter dengan beberapa nilai untuk kueri instans EC2 yang berjalan dan dihentikan**  

```
$InstanceParams = @{
    Filter = @(
        @{'Name' = 'instance-state-name';'Values' = @("running","stopped")}
    )
}

(Get-EC2Instance @InstanceParams).Instances
```
**Output:**  

```
InstanceId          InstanceType Platform PrivateIpAddress PublicIpAddress SecurityGroups SubnetId        VpcId
----------          ------------ -------- ---------------- --------------- -------------- --------        -----
i-05a9...f6c5f46e18 t3.medium             10.0.1.7                         ...            subnet-1a2b3c4d vpc-1a2b3c4d
i-02cf...945c4fdd07 t3.medium    Windows  10.0.1.8                         ...            subnet-1a2b3c4d vpc-1a2b3c4d
i-0ac0...c037f9f3a1 t3.xlarge    Windows  10.0.1.10                        ...            subnet-1a2b3c4d vpc-1a2b3c4d
i-066b...57b7b08888 t3.medium    Windows  10.0.1.11                        ...            subnet-1a2b3c4d vpc-1a2b3c4d
i-0fee...82e83ccd72 t3.medium    Windows  10.0.1.5                         ...            subnet-1a2b3c4d vpc-1a2b3c4d
i-0a68...274cc5043b t3.medium    Windows  10.0.1.6                         ...            subnet-1a2b3c4d vpc-1a2b3c4d
```
**Contoh 5: Contoh ini menggambarkan penggunaan filter dengan beberapa nilai untuk kueri instans EC2 yang berjalan dan dihentikan dan menggunakan cmdlet Select-Object untuk memilih nilai tertentu yang akan dikeluarkan.**  

```
$InstanceParams = @{
    Filter = @(
        @{'Name' = 'instance-state-name';'Values' = @("running","stopped")}
    )
}

$SelectParams = @{
    Property = @(
        "InstanceID", "InstanceType", "Platform", "PrivateIpAddress",
        @{Name="Name";Expression={$_.Tags[$_.Tags.Key.IndexOf("Name")].Value}},
        @{Name="State";Expression={$_.State.Name}}
    )
}

$result = Get-EC2Instance @InstanceParams
$result.Instances | Select-Object @SelectParams | Format-Table -AutoSize
```
**Output:**  

```
InstanceId          InstanceType Platform PrivateIpAddress Name         State
----------          ------------ -------- ---------------- ----         -----
i-05a9...f6c5f46e18 t3.medium             10.0.1.7         ec2-name-01  running
i-02cf...945c4fdd07 t3.medium    Windows  10.0.1.8         ec2-name-02  stopped
i-0ac0...c037f9f3a1 t3.xlarge    Windows  10.0.1.10        ec2-name-03  running
i-066b...57b7b08888 t3.medium    Windows  10.0.1.11        ec2-name-04  stopped
i-0fee...82e83ccd72 t3.medium    Windows  10.0.1.5         ec2-name-05  running
i-0a68...274cc5043b t3.medium    Windows  10.0.1.6         ec2-name-06  stopped
```
+  Untuk detail API, lihat [DescribeInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2InstanceAttribute`
<a name="ec2_DescribeInstanceAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2InstanceAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan jenis instance dari instance yang ditentukan.**  

```
Get-EC2InstanceAttribute -InstanceId i-12345678 -Attribute instanceType
```
**Output:**  

```
InstanceType                      : t2.micro
```
**Contoh 2: Contoh ini menjelaskan apakah jaringan yang disempurnakan diaktifkan untuk instance yang ditentukan.**  

```
Get-EC2InstanceAttribute -InstanceId i-12345678 -Attribute sriovNetSupport
```
**Output:**  

```
SriovNetSupport                   : simple
```
**Contoh 3: Contoh ini menjelaskan grup keamanan untuk instance tertentu.**  

```
(Get-EC2InstanceAttribute -InstanceId i-12345678 -Attribute groupSet).Groups
```
**Output:**  

```
GroupId
-------
sg-12345678
sg-45678901
```
**Contoh 4: Contoh ini menjelaskan apakah optimasi EBS diaktifkan untuk instance yang ditentukan.**  

```
Get-EC2InstanceAttribute -InstanceId i-12345678 -Attribute ebsOptimized
```
**Output:**  

```
EbsOptimized                      : False
```
**Contoh 5: Contoh ini menjelaskan atribut disableApiTermination '' dari contoh yang ditentukan.**  

```
Get-EC2InstanceAttribute -InstanceId i-12345678 -Attribute disableApiTermination
```
**Output:**  

```
DisableApiTermination             : False
```
**Contoh 6: Contoh ini menjelaskan atribut 'instanceInitiatedShutdownPerilaku' dari contoh yang ditentukan.**  

```
Get-EC2InstanceAttribute -InstanceId i-12345678 -Attribute instanceInitiatedShutdownBehavior
```
**Output:**  

```
InstanceInitiatedShutdownBehavior : stop
```
+  Untuk detail API, lihat [DescribeInstanceAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2InstanceMetadata`
<a name="ec2_Get-EC2InstanceMetadata_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2InstanceMetadata`.

**Alat untuk PowerShell V4**  
**Contoh 1: Daftar kategori metadata instance yang tersedia yang dapat ditanyakan.**  

```
Get-EC2InstanceMetadata -ListCategory
```
**Output:**  

```
AmiId
LaunchIndex
ManifestPath
AncestorAmiId
BlockDeviceMapping
InstanceId
InstanceType
LocalHostname
LocalIpv4
KernelId
AvailabilityZone
ProductCode
PublicHostname
PublicIpv4
PublicKey
RamdiskId
Region
ReservationId
SecurityGroup
UserData
InstanceMonitoring
IdentityDocument
IdentitySignature
IdentityPkcs7
```
**Contoh 2: Mengembalikan id Amazon Machine Image (AMI) yang digunakan untuk meluncurkan instance.**  

```
Get-EC2InstanceMetadata -Category AmiId
```
**Output:**  

```
ami-b2e756ca
```
**Contoh 3: Contoh ini menanyakan dokumen identitas berformat JSON untuk instance tersebut.**  

```
Get-EC2InstanceMetadata -Category IdentityDocument
{
  "availabilityZone" : "us-west-2a",
  "devpayProductCodes" : null,
  "marketplaceProductCodes" : null,
  "version" : "2017-09-30",
  "instanceId" : "i-01ed50f7e2607f09e",
  "billingProducts" : [ "bp-6ba54002" ],
  "instanceType" : "t2.small",
  "pendingTime" : "2018-03-07T16:26:04Z",
  "imageId" : "ami-b2e756ca",
  "privateIp" : "10.0.0.171",
  "accountId" : "111122223333",
  "architecture" : "x86_64",
  "kernelId" : null,
  "ramdiskId" : null,
  "region" : "us-west-2"
}
```
**Contoh 4: Contoh ini menggunakan kueri jalur untuk mendapatkan macs antarmuka jaringan untuk instance.**  

```
Get-EC2InstanceMetadata -Path "/network/interfaces/macs"
```
**Output:**  

```
02:80:7f:ef:4c:e0/
```
**Contoh 5: Jika ada peran IAM yang terkait dengan instance, mengembalikan informasi tentang terakhir kali profil instance diperbarui, termasuk LastUpdated tanggal instans, InstanceProfileArn, dan InstanceProfileId.**  

```
Get-EC2InstanceMetadata -Path "/iam/info"
```
**Output:**  

```
{
  "Code" : "Success",
  "LastUpdated" : "2018-03-08T03:38:40Z",
  "InstanceProfileArn" : "arn:aws:iam::111122223333:instance-profile/MyLaunchRole_Profile",
  "InstanceProfileId" : "AIPAI4...WVK2RW"
}
```
+  Untuk detail API, lihat [Get-EC2InstanceMetadata](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2InstanceStatus`
<a name="ec2_DescribeInstanceStatus_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2InstanceStatus`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan status instance yang ditentukan.**  

```
Get-EC2InstanceStatus -InstanceId i-12345678
```
**Output:**  

```
AvailabilityZone : us-west-2a
Events           : {}
InstanceId       : i-12345678
InstanceState    : Amazon.EC2.Model.InstanceState
Status           : Amazon.EC2.Model.InstanceStatusSummary
SystemStatus     : Amazon.EC2.Model.InstanceStatusSummary
```

```
$status = Get-EC2InstanceStatus -InstanceId i-12345678
$status.InstanceState
```
**Output:**  

```
Code    Name
----    ----
16      running
```

```
$status.Status
```
**Output:**  

```
Details           Status
-------           ------
{reachability}    ok
```

```
$status.SystemStatus
```
**Output:**  

```
Details           Status
-------           ------
{reachability}    ok
```
+  Untuk detail API, lihat [DescribeInstanceStatus](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2InternetGateway`
<a name="ec2_DescribeInternetGateways_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2InternetGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan gateway Internet yang ditentukan.**  

```
Get-EC2InternetGateway -InternetGatewayId igw-1a2b3c4d
```
**Output:**  

```
Attachments       InternetGatewayId     Tags
-----------       -----------------     ----
{vpc-1a2b3c4d}    igw-1a2b3c4d          {}
```
**Contoh 2: Contoh ini menjelaskan semua gateway Internet Anda.**  

```
Get-EC2InternetGateway
```
**Output:**  

```
Attachments       InternetGatewayId     Tags
-----------       -----------------     ----
{vpc-1a2b3c4d}    igw-1a2b3c4d          {}
{}                igw-2a3b4c5d          {}
```
+  Untuk detail API, lihat [DescribeInternetGateways](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2KeyPair`
<a name="ec2_DescribeKeyPairs_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2KeyPair`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan key pair yang ditentukan.**  

```
Get-EC2KeyPair -KeyName my-key-pair
```
**Output:**  

```
KeyFingerprint                                              KeyName
--------------                                              -------
1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f my-key-pair
```
**Contoh 2: Contoh ini menjelaskan semua pasangan kunci Anda.**  

```
Get-EC2KeyPair
```
+  Untuk detail API, lihat [DescribeKeyPairs](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2NetworkAcl`
<a name="ec2_DescribeNetworkAcls_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2NetworkAcl`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan ACL jaringan tertentu.**  

```
Get-EC2NetworkAcl -NetworkAclId acl-12345678
```
**Output:**  

```
Associations : {aclassoc-1a2b3c4d}
Entries      : {Amazon.EC2.Model.NetworkAclEntry, Amazon.EC2.Model.NetworkAclEntry}
IsDefault    : False
NetworkAclId : acl-12345678
Tags         : {Name}
VpcId        : vpc-12345678
```
**Contoh 2: Contoh ini menjelaskan aturan untuk ACL jaringan yang ditentukan.**  

```
(Get-EC2NetworkAcl -NetworkAclId acl-12345678).Entries
```
**Output:**  

```
CidrBlock    : 0.0.0.0/0
Egress       : True
IcmpTypeCode :
PortRange    :
Protocol     : -1
RuleAction   : deny
RuleNumber   : 32767

CidrBlock    : 0.0.0.0/0
Egress       : False
IcmpTypeCode :
PortRange    :
Protocol     : -1
RuleAction   : deny
RuleNumber   : 32767
```
**Contoh 3: Contoh ini menjelaskan semua jaringan Anda ACLs.**  

```
Get-EC2NetworkAcl
```
+  Untuk detail API, lihat [DescribeNetworkAcls](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2NetworkInterface`
<a name="ec2_DescribeNetworkInterfaces_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2NetworkInterface`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan antarmuka jaringan yang ditentukan.**  

```
Get-EC2NetworkInterface -NetworkInterfaceId eni-12345678
```
**Output:**  

```
Association        :
Attachment         : Amazon.EC2.Model.NetworkInterfaceAttachment
AvailabilityZone   : us-west-2c
Description        :
Groups             : {my-security-group}
MacAddress         : 0a:e9:a6:19:4c:7f
NetworkInterfaceId : eni-12345678
OwnerId            : 123456789012
PrivateDnsName     : ip-10-0-0-107.us-west-2.compute.internal
PrivateIpAddress   : 10.0.0.107
PrivateIpAddresses : {ip-10-0-0-107.us-west-2.compute.internal}
RequesterId        :
RequesterManaged   : False
SourceDestCheck    : True
Status             : in-use
SubnetId           : subnet-1a2b3c4d
TagSet             : {}
VpcId              : vpc-12345678
```
**Contoh 2: Contoh ini menjelaskan semua antarmuka jaringan Anda.**  

```
Get-EC2NetworkInterface
```
+  Untuk detail API, lihat [DescribeNetworkInterfaces](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2NetworkInterfaceAttribute`
<a name="ec2_DescribeNetworkInterfaceAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2NetworkInterfaceAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan antarmuka jaringan yang ditentukan.**  

```
Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute Attachment
```
**Output:**  

```
Attachment         : Amazon.EC2.Model.NetworkInterfaceAttachment
```
**Contoh 2: Contoh ini menjelaskan antarmuka jaringan yang ditentukan.**  

```
Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute Description
```
**Output:**  

```
Description        : My description
```
**Contoh 3: Contoh ini menjelaskan antarmuka jaringan yang ditentukan.**  

```
Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute GroupSet
```
**Output:**  

```
Groups             : {my-security-group}
```
**Contoh 4: Contoh ini menjelaskan antarmuka jaringan yang ditentukan.**  

```
Get-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-12345678 -Attribute SourceDestCheck
```
**Output:**  

```
SourceDestCheck    : True
```
+  Untuk detail API, lihat [DescribeNetworkInterfaceAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2PasswordData`
<a name="ec2_GetPasswordData_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2PasswordData`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mendekripsi kata sandi yang ditetapkan Amazon EC2 ke akun Administrator untuk instance Windows yang ditentukan. Sebagai file PEM ditentukan, pengaturan sakelar -Decrypt secara otomatis diasumsikan.**  

```
Get-EC2PasswordData -InstanceId i-12345678 -PemFile C:\path\my-key-pair.pem
```
**Output:**  

```
mYZ(PA9?C)Q
```
**Contoh 2: ( PowerShell Hanya Windows) Memeriksa instance untuk menentukan nama keypair yang digunakan untuk meluncurkan instance dan kemudian mencoba menemukan data keypair yang sesuai di penyimpanan konfigurasi Toolkit for Visual AWS Studio. Jika data keypair ditemukan, kata sandi didekripsi.**  

```
Get-EC2PasswordData -InstanceId i-12345678 -Decrypt
```
**Output:**  

```
mYZ(PA9?C)Q
```
**Contoh 3: Mengembalikan data kata sandi terenkripsi untuk contoh.**  

```
Get-EC2PasswordData -InstanceId i-12345678
```
**Output:**  

```
iVz3BAK/WAXV.....dqt8WeMA==
```
+  Untuk detail API, lihat [GetPasswordData](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2PlacementGroup`
<a name="ec2_DescribePlacementGroups_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2PlacementGroup`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan grup penempatan yang ditentukan.**  

```
Get-EC2PlacementGroup -GroupName my-placement-group
```
**Output:**  

```
GroupName             State        Strategy
---------             -----        --------
my-placement-group    available    cluster
```
+  Untuk detail API, lihat [DescribePlacementGroups](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2PrefixList`
<a name="ec2_DescribePrefixLists_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2PrefixList`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengambil yang tersedia Layanan AWS dalam format daftar awalan untuk wilayah**  

```
Get-EC2PrefixList
```
**Output:**  

```
Cidrs                                          PrefixListId PrefixListName
-----                                          ------------ --------------
{52.94.5.0/24, 52.119.240.0/21, 52.94.24.0/23} pl-6fa54006  com.amazonaws.eu-west-1.dynamodb
{52.218.0.0/17, 54.231.128.0/19}               pl-6da54004  com.amazonaws.eu-west-1.s3
```
+  Untuk detail API, lihat [DescribePrefixLists](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Region`
<a name="ec2_DescribeRegions_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Region`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan wilayah yang tersedia untuk Anda.**  

```
Get-EC2Region
```
**Output:**  

```
Endpoint                            RegionName
--------                            ----------
ec2.eu-west-1.amazonaws.com         eu-west-1
ec2.ap-southeast-1.amazonaws.com    ap-southeast-1
ec2.ap-southeast-2.amazonaws.com    ap-southeast-2
ec2.eu-central-1.amazonaws.com      eu-central-1
ec2.ap-northeast-1.amazonaws.com    ap-northeast-1
ec2.us-east-1.amazonaws.com         us-east-1
ec2.sa-east-1.amazonaws.com         sa-east-1
ec2.us-west-1.amazonaws.com         us-west-1
ec2.us-west-2.amazonaws.com         us-west-2
```
+  Untuk detail API, lihat [DescribeRegions](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2RouteTable`
<a name="ec2_DescribeRouteTables_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2RouteTable`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan semua tabel rute Anda.**  

```
Get-EC2RouteTable
```
**Output:**  

```
DestinationCidrBlock    : 10.0.0.0/16
DestinationPrefixListId :
GatewayId               : local
InstanceId              :
InstanceOwnerId         :
NetworkInterfaceId      :
Origin                  : CreateRouteTable
State                   : active
VpcPeeringConnectionId  :

DestinationCidrBlock    : 0.0.0.0/0
DestinationPrefixListId :
GatewayId               : igw-1a2b3c4d
InstanceId              :
InstanceOwnerId         :
NetworkInterfaceId      :
Origin                  : CreateRoute
State                   : active
VpcPeeringConnectionId  :
```
**Contoh 2: Contoh ini mengembalikan rincian untuk tabel rute yang ditentukan.**  

```
Get-EC2RouteTable -RouteTableId rtb-1a2b3c4d
```
**Contoh 3: Contoh ini menjelaskan tabel rute untuk VPC yang ditentukan.**  

```
Get-EC2RouteTable -Filter @{ Name="vpc-id"; Values="vpc-1a2b3c4d" }
```
**Output:**  

```
Associations    : {rtbassoc-12345678}
PropagatingVgws : {}
Routes          : {, }
RouteTableId    : rtb-1a2b3c4d
Tags            : {}
VpcId           : vpc-1a2b3c4d
```
+  Untuk detail API, lihat [DescribeRouteTables](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2ScheduledInstance`
<a name="ec2_DescribeScheduledInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2ScheduledInstance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan Instance Terjadwal yang ditentukan.**  

```
Get-EC2ScheduledInstance -ScheduledInstanceId sci-1234-1234-1234-1234-123456789012
```
**Output:**  

```
AvailabilityZone            : us-west-2b
CreateDate                  : 1/25/2016 1:43:38 PM
HourlyPrice                 : 0.095
InstanceCount               : 1
InstanceType                : c4.large
NetworkPlatform             : EC2-VPC
NextSlotStartTime           : 1/31/2016 1:00:00 AM
Platform                    : Linux/UNIX
PreviousSlotEndTime         : 
Recurrence                  : Amazon.EC2.Model.ScheduledInstanceRecurrence
ScheduledInstanceId         : sci-1234-1234-1234-1234-123456789012
SlotDurationInHours         : 32
TermEndDate                 : 1/31/2017 1:00:00 AM
TermStartDate               : 1/31/2016 1:00:00 AM
TotalScheduledInstanceHours : 1696
```
**Contoh 2: Contoh ini menjelaskan semua Instans Terjadwal Anda.**  

```
Get-EC2ScheduledInstance
```
+  Untuk detail API, lihat [DescribeScheduledInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2ScheduledInstanceAvailability`
<a name="ec2_DescribeScheduledInstanceAvailability_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2ScheduledInstanceAvailability`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan jadwal yang terjadi setiap minggu pada hari Minggu, dimulai pada tanggal yang ditentukan.**  

```
Get-EC2ScheduledInstanceAvailability -Recurrence_Frequency Weekly -Recurrence_Interval 1 -Recurrence_OccurrenceDay 1 -FirstSlotStartTimeRange_EarliestTime 2016-01-31T00:00:00Z -FirstSlotStartTimeRange_LatestTime 2016-01-31T04:00:00Z
```
**Output:**  

```
AvailabilityZone            : us-west-2b
AvailableInstanceCount      : 20
FirstSlotStartTime          : 1/31/2016 8:00:00 AM
HourlyPrice                 : 0.095
InstanceType                : c4.large
MaxTermDurationInDays       : 366
MinTermDurationInDays       : 366
NetworkPlatform             : EC2-VPC
Platform                    : Linux/UNIX
PurchaseToken               : eyJ2IjoiMSIsInMiOjEsImMiOi...
Recurrence                  : Amazon.EC2.Model.ScheduledInstanceRecurrence
SlotDurationInHours         : 23
TotalScheduledInstanceHours : 1219

...
```
**Contoh 2: Untuk mempersempit hasil, Anda dapat menambahkan filter untuk kriteria seperti sistem operasi, jaringan, dan jenis instance.**  

```
-Filter @{ Name="platform";Values="Linux/UNIX" },@{ Name="network-platform";Values="EC2-VPC" },@{ Name="instance-type";Values="c4.large" }
```
+  Untuk detail API, lihat [DescribeScheduledInstanceAvailability](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2SecurityGroup`
<a name="ec2_DescribeSecurityGroups_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2SecurityGroup`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan grup keamanan yang ditentukan untuk VPC. Saat bekerja dengan grup keamanan milik VPC, Anda harus menggunakan ID grup keamanan (- GroupId parameter), bukan nama (- GroupName parameter), untuk mereferensikan grup.**  

```
Get-EC2SecurityGroup -GroupId sg-12345678
```
**Output:**  

```
Description         : default VPC security group
GroupId             : sg-12345678
GroupName           : default
IpPermissions       : {Amazon.EC2.Model.IpPermission}
IpPermissionsEgress : {Amazon.EC2.Model.IpPermission}
OwnerId             : 123456789012
Tags                : {}
VpcId               : vpc-12345678
```
**Contoh 2: Contoh ini menjelaskan grup keamanan yang ditentukan untuk EC2-Classic. Saat bekerja dengan grup keamanan untuk EC2-Classic Anda dapat menggunakan nama grup (- GroupName parameter) atau ID grup (- GroupId parameter) untuk mereferensikan grup keamanan.**  

```
Get-EC2SecurityGroup -GroupName my-security-group
```
**Output:**  

```
Description         : my security group
GroupId             : sg-45678901
GroupName           : my-security-group
IpPermissions       : {Amazon.EC2.Model.IpPermission, Amazon.EC2.Model.IpPermission}
IpPermissionsEgress : {}
OwnerId             : 123456789012
Tags                : {}
VpcId               :
```
**Contoh 3: Contoh ini mengambil semua grup keamanan untuk vpc-0fc1ff23456b789eb**  

```
Get-EC2SecurityGroup -Filter @{Name="vpc-id";Values="vpc-0fc1ff23456b789eb"}
```
+  Untuk detail API, lihat [DescribeSecurityGroups](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Snapshot`
<a name="ec2_DescribeSnapshots_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Snapshot`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan snapshot yang ditentukan.**  

```
Get-EC2Snapshot -SnapshotId snap-12345678
```
**Output:**  

```
DataEncryptionKeyId :
Description         : Created by CreateImage(i-1a2b3c4d) for ami-12345678 from vol-12345678
Encrypted           : False
KmsKeyId            :
OwnerAlias          :
OwnerId             : 123456789012
Progress            : 100%
SnapshotId          : snap-12345678
StartTime           : 10/23/2014 6:01:28 AM
State               : completed
StateMessage        :
Tags                : {}
VolumeId            : vol-12345678
VolumeSize          : 8
```
**Contoh 2: Contoh ini menjelaskan snapshot yang memiliki tag 'Nama'.**  

```
Get-EC2Snapshot | ? { $_.Tags.Count -gt 0 -and $_.Tags.Key -eq "Name" }
```
**Contoh 3: Contoh ini menjelaskan snapshot yang memiliki tag 'Nama' dengan nilai 'TestValue'.**  

```
Get-EC2Snapshot | ? { $_.Tags.Count -gt 0 -and $_.Tags.Key -eq "Name" -and $_.Tags.Value -eq "TestValue" }
```
**Contoh 4: Contoh ini menjelaskan semua snapshot Anda.**  

```
Get-EC2Snapshot -Owner self
```
+  Untuk detail API, lihat [DescribeSnapshots](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2SnapshotAttribute`
<a name="ec2_DescribeSnapshotAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2SnapshotAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan atribut tertentu dari snapshot yang ditentukan.**  

```
Get-EC2SnapshotAttribute -SnapshotId snap-12345678 -Attribute ProductCodes
```
**Output:**  

```
CreateVolumePermissions    ProductCodes    SnapshotId
-----------------------    ------------    ----------
{}                         {}              snap-12345678
```
**Contoh 2: Contoh ini menjelaskan atribut tertentu dari snapshot yang ditentukan.**  

```
(Get-EC2SnapshotAttribute -SnapshotId snap-12345678 -Attribute CreateVolumePermission).CreateVolumePermissions
```
**Output:**  

```
Group    UserId
-----    ------
all
```
+  Untuk detail API, lihat [DescribeSnapshotAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2SpotDatafeedSubscription`
<a name="ec2_DescribeSpotDatafeedSubscription_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2SpotDatafeedSubscription`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan umpan data instans Spot Anda.**  

```
Get-EC2SpotDatafeedSubscription
```
**Output:**  

```
Bucket  : amzn-s3-demo-bucket
Fault   :
OwnerId : 123456789012
Prefix  : spotdata
State   : Active
```
+  Untuk detail API, lihat [DescribeSpotDatafeedSubscription](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2SpotFleetInstance`
<a name="ec2_DescribeSpotFleetInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2SpotFleetInstance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan instance yang terkait dengan permintaan armada Spot yang ditentukan.**  

```
Get-EC2SpotFleetInstance -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
```
**Output:**  

```
InstanceId    InstanceType    SpotInstanceRequestId
----------    ------------    ---------------------
i-f089262a    c3.large        sir-12345678
i-7e8b24a4    c3.large        sir-87654321
```
+  Untuk detail API, lihat [DescribeSpotFleetInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2SpotFleetRequest`
<a name="ec2_DescribeSpotFleetRequests_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2SpotFleetRequest`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan permintaan armada Spot yang ditentukan.**  

```
Get-EC2SpotFleetRequest -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE | format-list
```
**Output:**  

```
ConfigData            : Amazon.EC2.Model.SpotFleetRequestConfigData
CreateTime            : 12/26/2015 8:23:33 AM
SpotFleetRequestId    : sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE
SpotFleetRequestState : active
```
**Contoh 2: Contoh ini menjelaskan semua permintaan armada Spot Anda.**  

```
Get-EC2SpotFleetRequest
```
+  Untuk detail API, lihat [DescribeSpotFleetRequests](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2SpotFleetRequestHistory`
<a name="ec2_DescribeSpotFleetRequestHistory_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2SpotFleetRequestHistory`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan riwayat permintaan armada Spot yang ditentukan.**  

```
Get-EC2SpotFleetRequestHistory -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -StartTime 2015-12-26T00:00:00Z
```
**Output:**  

```
HistoryRecords     : {Amazon.EC2.Model.HistoryRecord, Amazon.EC2.Model.HistoryRecord...}
LastEvaluatedTime  : 12/26/2015 8:29:11 AM
NextToken          :
SpotFleetRequestId : sfr-088bc5f1-7e7b-451a-bd13-757f10672b93
StartTime          : 12/25/2015 8:00:00 AM
```

```
(Get-EC2SpotFleetRequestHistory -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -StartTime 2015-12-26T00:00:00Z).HistoryRecords
```
**Output:**  

```
EventInformation                     EventType             Timestamp
----------------                     ---------             ---------
Amazon.EC2.Model.EventInformation    fleetRequestChange    12/26/2015 8:23:33 AM
Amazon.EC2.Model.EventInformation    fleetRequestChange    12/26/2015 8:23:33 AM
Amazon.EC2.Model.EventInformation    fleetRequestChange    12/26/2015 8:23:33 AM
Amazon.EC2.Model.EventInformation    launched              12/26/2015 8:25:34 AM
Amazon.EC2.Model.EventInformation    launched              12/26/2015 8:25:05 AM
```
+  Untuk detail API, lihat [DescribeSpotFleetRequestHistory](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2SpotInstanceRequest`
<a name="ec2_DescribeSpotInstanceRequests_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2SpotInstanceRequest`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan permintaan instance Spot yang ditentukan.**  

```
Get-EC2SpotInstanceRequest -SpotInstanceRequestId sir-12345678
```
**Output:**  

```
ActualBlockHourlyPrice   :
AvailabilityZoneGroup    :
BlockDurationMinutes     : 0
CreateTime               : 4/8/2015 2:51:33 PM
Fault                    :
InstanceId               : i-12345678
LaunchedAvailabilityZone : us-west-2b
LaunchGroup              :
LaunchSpecification      : Amazon.EC2.Model.LaunchSpecification
ProductDescription       : Linux/UNIX
SpotInstanceRequestId    : sir-12345678
SpotPrice                : 0.020000
State                    : active
Status                   : Amazon.EC2.Model.SpotInstanceStatus
Tags                     : {Name}
Type                     : one-time
```
**Contoh 2: Contoh ini menjelaskan semua permintaan instans Spot Anda.**  

```
Get-EC2SpotInstanceRequest
```
+  Untuk detail API, lihat [DescribeSpotInstanceRequests](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2SpotPriceHistory`
<a name="ec2_DescribeSpotPriceHistory_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2SpotPriceHistory`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mendapatkan 10 entri terakhir dalam riwayat harga Spot untuk jenis instans tertentu dan Availability Zone. Perhatikan bahwa nilai yang ditentukan untuk AvailabilityZone parameter - harus valid untuk nilai wilayah yang diberikan ke parameter -Region cmdlet (tidak ditampilkan dalam contoh) atau ditetapkan sebagai default di shell. Perintah contoh ini mengasumsikan wilayah default 'us-west-2' telah disetel di lingkungan.**  

```
Get-EC2SpotPriceHistory -InstanceType c3.large -AvailabilityZone us-west-2a -MaxResult 10
```
**Output:**  

```
AvailabilityZone   : us-west-2a
InstanceType       : c3.large
Price              : 0.017300
ProductDescription : Linux/UNIX (Amazon VPC)
Timestamp          : 12/25/2015 7:39:49 AM

AvailabilityZone   : us-west-2a
InstanceType       : c3.large
Price              : 0.017200
ProductDescription : Linux/UNIX (Amazon VPC)
Timestamp          : 12/25/2015 7:38:29 AM

AvailabilityZone   : us-west-2a
InstanceType       : c3.large
Price              : 0.017300
ProductDescription : Linux/UNIX (Amazon VPC)
Timestamp          : 12/25/2015 6:57:13 AM
...
```
+  Untuk detail API, lihat [DescribeSpotPriceHistory](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Subnet`
<a name="ec2_DescribeSubnets_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Subnet`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan subnet yang ditentukan.**  

```
Get-EC2Subnet -SubnetId subnet-1a2b3c4d
```
**Output:**  

```
AvailabilityZone        : us-west-2c
AvailableIpAddressCount : 251
CidrBlock               : 10.0.0.0/24
DefaultForAz            : False
MapPublicIpOnLaunch     : False
State                   : available
SubnetId                : subnet-1a2b3c4d
Tags                    : {}
VpcId                   : vpc-12345678
```
**Contoh 2: Contoh ini menjelaskan semua subnet Anda.**  

```
Get-EC2Subnet
```
+  Untuk detail API, lihat [DescribeSubnets](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Tag`
<a name="ec2_DescribeTags_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Tag`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengambil tag untuk 'image' tipe sumber daya**  

```
Get-EC2Tag -Filter @{Name="resource-type";Values="image"}
```
**Output:**  

```
Key         ResourceId            ResourceType Value
---         ----------            ------------ -----
Name        ami-0a123b4ccb567a8ea image        Win7-Imported
auto-delete ami-0a123b4ccb567a8ea image        never
```
**Contoh 2: Contoh ini mengambil semua tag untuk semua sumber daya dan mengelompokkannya berdasarkan jenis sumber daya**  

```
Get-EC2Tag | Group-Object resourcetype
```
**Output:**  

```
Count Name                      Group
----- ----                      -----
    9 subnet                    {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription...}
   53 instance                  {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription...}
    3 route-table               {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription}
    5 security-group            {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription...}
   30 volume                    {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription...}
    1 internet-gateway          {Amazon.EC2.Model.TagDescription}
    3 network-interface         {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription}
    4 elastic-ip                {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription}
    1 dhcp-options              {Amazon.EC2.Model.TagDescription}
    2 image                     {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription}
    3 vpc                       {Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription, Amazon.EC2.Model.TagDescription}
```
**Contoh 3: Contoh ini menampilkan semua sumber daya dengan tag 'auto-delete' dengan nilai 'no' untuk wilayah tertentu**  

```
Get-EC2Tag -Region eu-west-1 -Filter @{Name="tag:auto-delete";Values="no"}
```
**Output:**  

```
Key         ResourceId            ResourceType Value
---         ----------            ------------ -----
auto-delete i-0f1bce234d5dd678b   instance     no
auto-delete vol-01d234aa5678901a2 volume       no
auto-delete vol-01234bfb5def6f7b8 volume       no
auto-delete vol-01ccb23f4c5e67890 volume       no
```
**Contoh 4: Contoh ini memperoleh semua sumber daya dengan tag 'hapus otomatis' dengan nilai 'no' dan filter lebih lanjut di pipa berikutnya untuk mengurai hanya jenis sumber daya 'instance' dan akhirnya membuat tag 'ThisInstance' untuk setiap sumber daya instance dengan nilai menjadi id instance itu sendiri**  

```
Get-EC2Tag -Region eu-west-1 -Filter @{Name="tag:auto-delete";Values="no"} | Where-Object ResourceType -eq "instance" | ForEach-Object {New-EC2Tag -ResourceId $_.ResourceId -Tag @{Key="ThisInstance";Value=$_.ResourceId}}
```
**Contoh 5: Contoh ini mengambil tag untuk semua sumber daya instance serta kunci 'Nama' dan menampilkannya dalam format tabel**  

```
Get-EC2Tag -Filter @{Name="resource-type";Values="instance"},@{Name="key";Values="Name"} | Select-Object ResourceId, @{Name="Name-Tag";Expression={$PSItem.Value}} | Format-Table -AutoSize
```
**Output:**  

```
ResourceId          Name-Tag
----------          --------
i-012e3cb4df567e1aa jump1
i-01c23a45d6fc7a89f repro-3
```
+  Untuk detail API, lihat [DescribeTags](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Volume`
<a name="ec2_DescribeVolumes_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Volume`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan volume EBS yang ditentukan.**  

```
Get-EC2Volume -VolumeId vol-12345678
```
**Output:**  

```
Attachments      : {}
AvailabilityZone : us-west-2c
CreateTime       : 7/17/2015 4:35:19 PM
Encrypted        : False
Iops             : 90
KmsKeyId         :
Size             : 30
SnapshotId       : snap-12345678
State            : in-use
Tags             : {}
VolumeId         : vol-12345678
VolumeType       : standard
```
**Contoh 2: Contoh ini menjelaskan volume EBS Anda yang memiliki status 'tersedia'.**  

```
Get-EC2Volume -Filter @{ Name="status"; Values="available" }
```
**Output:**  

```
Attachments      : {}
AvailabilityZone : us-west-2c
CreateTime       : 12/21/2015 2:31:29 PM
Encrypted        : False
Iops             : 60
KmsKeyId         :
Size             : 20
SnapshotId       : snap-12345678
State            : available
Tags             : {}
VolumeId         : vol-12345678
VolumeType       : gp2
...
```
**Contoh 3: Contoh ini menjelaskan semua volume EBS Anda.**  

```
Get-EC2Volume
```
+  Untuk detail API, lihat [DescribeVolumes](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VolumeAttribute`
<a name="ec2_DescribeVolumeAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VolumeAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan atribut tertentu dari volume yang ditentukan.**  

```
Get-EC2VolumeAttribute -VolumeId vol-12345678 -Attribute AutoEnableIO
```
**Output:**  

```
AutoEnableIO    ProductCodes    VolumeId
------------    ------------    --------
False           {}              vol-12345678
```
+  Untuk detail API, lihat [DescribeVolumeAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VolumeStatus`
<a name="ec2_DescribeVolumeStatus_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VolumeStatus`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan status volume yang ditentukan.**  

```
Get-EC2VolumeStatus -VolumeId vol-12345678
```
**Output:**  

```
Actions          : {}
AvailabilityZone : us-west-2a
Events           : {}
VolumeId         : vol-12345678
VolumeStatus     : Amazon.EC2.Model.VolumeStatusInfo
```

```
(Get-EC2VolumeStatus -VolumeId vol-12345678).VolumeStatus
```
**Output:**  

```
Details                         Status
-------                         ------
{io-enabled, io-performance}    ok
```

```
(Get-EC2VolumeStatus -VolumeId vol-12345678).VolumeStatus.Details
```
**Output:**  

```
Name                            Status
----                            ------
io-enabled                      passed
io-performance                  not-applicable
```
+  Untuk detail API, lihat [DescribeVolumeStatus](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2Vpc`
<a name="ec2_DescribeVpcs_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2Vpc`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan VPC yang ditentukan.**  

```
Get-EC2Vpc -VpcId vpc-12345678
```
**Output:**  

```
CidrBlock       : 10.0.0.0/16
DhcpOptionsId   : dopt-1a2b3c4d
InstanceTenancy : default
IsDefault       : False
State           : available
Tags            : {Name}
VpcId           : vpc-12345678
```
**Contoh 2: Contoh ini menjelaskan VPC default (hanya ada satu per wilayah). Jika akun Anda mendukung EC2-Classic di wilayah ini, tidak ada VPC default.**  

```
Get-EC2Vpc -Filter @{Name="isDefault"; Values="true"}
```
**Output:**  

```
CidrBlock       : 172.31.0.0/16
DhcpOptionsId   : dopt-12345678
InstanceTenancy : default
IsDefault       : True
State           : available
Tags            : {}
VpcId           : vpc-45678901
```
**Contoh 3: Contoh ini menjelaskan VPCs yang cocok dengan filter yang ditentukan (yaitu, memiliki CIDR yang cocok dengan nilai '10.0.0.0/16' dan berada dalam keadaan 'tersedia').**  

```
Get-EC2Vpc -Filter @{Name="cidr"; Values="10.0.0.0/16"},@{Name="state";Values="available"}
```
**Contoh 4: Contoh ini menjelaskan semua Anda VPCs.**  

```
Get-EC2Vpc
```
+  Untuk detail API, lihat [DescribeVpcs](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VpcAttribute`
<a name="ec2_DescribeVpcAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VpcAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan atribut enableDnsSupport ''.**  

```
Get-EC2VpcAttribute -VpcId vpc-12345678 -Attribute enableDnsSupport
```
**Output:**  

```
EnableDnsSupport
----------------
True
```
**Contoh 2: Contoh ini menjelaskan atribut enableDnsHostnames ''.**  

```
Get-EC2VpcAttribute -VpcId vpc-12345678 -Attribute enableDnsHostnames
```
**Output:**  

```
EnableDnsHostnames
------------------
True
```
+  Untuk detail API, lihat [DescribeVpcAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VpcClassicLink`
<a name="ec2_DescribeVpcClassicLink_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VpcClassicLink`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh di atas mengembalikan semua VPCs dengan ClassicLinkEnabled negara mereka untuk wilayah**  

```
Get-EC2VpcClassicLink -Region eu-west-1
```
**Output:**  

```
ClassicLinkEnabled Tags   VpcId
------------------ ----   -----
False              {Name} vpc-0fc1ff23f45b678eb
False              {}     vpc-01e23c4a5d6db78e9
False              {Name} vpc-0123456b078b9d01f
False              {}     vpc-12cf3b4f
False              {Name} vpc-0b12d3456a7e8901d
```
+  Untuk detail API, lihat [DescribeVpcClassicLink](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VpcClassicLinkDnsSupport`
<a name="ec2_DescribeVpcClassicLinkDnsSupport_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VpcClassicLinkDnsSupport`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan status dukungan ClassicLink DNS VPCs untuk wilayah eu-west-1**  

```
Get-EC2VpcClassicLinkDnsSupport -VpcId vpc-0b12d3456a7e8910d -Region eu-west-1
```
**Output:**  

```
ClassicLinkDnsSupported VpcId
----------------------- -----
False                   vpc-0b12d3456a7e8910d
False                   vpc-12cf3b4f
```
+  Untuk detail API, lihat [DescribeVpcClassicLinkDnsSupport](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VpcEndpoint`
<a name="ec2_DescribeVpcEndpoints_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VpcEndpoint`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan satu atau beberapa titik akhir VPC Anda untuk wilayah eu-west-1. Kemudian pipa output ke perintah berikutnya, yang memilih VpcEndpointId properti dan mengembalikan array VPC ID sebagai string array**  

```
Get-EC2VpcEndpoint -Region eu-west-1 | Select-Object -ExpandProperty VpcEndpointId
```
**Output:**  

```
vpce-01a2ab3f4f5cc6f7d
vpce-01d2b345a6787890b
vpce-0012e34d567890e12
vpce-0c123db4567890123
```
**Contoh 2: Contoh ini menjelaskan semua titik akhir vpc untuk wilayah eu-west-1 dan memilih,, dan properti untuk menyajikannya dalam format tabel VpcEndpointId VpcId ServiceName PrivateDnsEnabled **  

```
Get-EC2VpcEndpoint -Region eu-west-1 | Select-Object VpcEndpointId, VpcId, ServiceName, PrivateDnsEnabled | Format-Table -AutoSize
```
**Output:**  

```
VpcEndpointId          VpcId                 ServiceName                         PrivateDnsEnabled
-------------          -----                 -----------                         -----------------
vpce-02a2ab2f2f2cc2f2d vpc-0fc6ff46f65b039eb com.amazonaws.eu-west-1.ssm                      True
vpce-01d1b111a1114561b vpc-0fc6ff46f65b039eb com.amazonaws.eu-west-1.ec2                      True
vpce-0011e23d45167e838 vpc-0fc6ff46f65b039eb com.amazonaws.eu-west-1.ec2messages              True
vpce-0c123db4567890123 vpc-0fc6ff46f65b039eb com.amazonaws.eu-west-1.ssmmessages              True
```
**Contoh 3: Contoh ini mengekspor dokumen kebijakan untuk VPC Endpoint vpce-01a2ab3f4f5cc6f7d ke dalam file json**  

```
Get-EC2VpcEndpoint -Region eu-west-1 -VpcEndpointId vpce-01a2ab3f4f5cc6f7d | Select-Object -expand PolicyDocument | Out-File vpce_policyDocument.json
```
+  Untuk detail API, lihat [DescribeVpcEndpoints](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VpcEndpointService`
<a name="ec2_DescribeVpcEndpointServices_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VpcEndpointService`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan layanan titik akhir VPC EC2 dengan filter yang diberikan, dalam hal ini com.amazonaws.eu-west-1.ecs. Selanjutnya, itu juga memperluas ServiceDetails properti dan menampilkan detailnya**  

```
Get-EC2VpcEndpointService -Region eu-west-1 -MaxResult 5 -Filter @{Name="service-name";Values="com.amazonaws.eu-west-1.ecs"} | Select-Object -ExpandProperty ServiceDetails
```
**Output:**  

```
AcceptanceRequired         : False
AvailabilityZones          : {eu-west-1a, eu-west-1b, eu-west-1c}
BaseEndpointDnsNames       : {ecs.eu-west-1.vpce.amazonaws.com}
Owner                      : amazon
PrivateDnsName             : ecs.eu-west-1.amazonaws.com
ServiceName                : com.amazonaws.eu-west-1.ecs
ServiceType                : {Amazon.EC2.Model.ServiceTypeDetail}
VpcEndpointPolicySupported : False
```
**Contoh 2: Contoh ini mengambil semua layanan Titik Akhir VPC EC2 dan mengembalikan “ssm” yang cocok ServiceNames **  

```
Get-EC2VpcEndpointService -Region eu-west-1 | Select-Object -ExpandProperty Servicenames | Where-Object { -match "ssm"}
```
**Output:**  

```
com.amazonaws.eu-west-1.ssm
com.amazonaws.eu-west-1.ssmmessages
```
+  Untuk detail API, lihat [DescribeVpcEndpointServices](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VpnConnection`
<a name="ec2_DescribeVpnConnections_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VpnConnection`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan koneksi VPN yang ditentukan.**  

```
Get-EC2VpnConnection -VpnConnectionId vpn-12345678
```
**Output:**  

```
CustomerGatewayConfiguration : [XML document]
CustomerGatewayId            : cgw-1a2b3c4d
Options                      : Amazon.EC2.Model.VpnConnectionOptions
Routes                       : {Amazon.EC2.Model.VpnStaticRoute}
State                        : available
Tags                         : {}
Type                         : ipsec.1
VgwTelemetry                 : {Amazon.EC2.Model.VgwTelemetry, Amazon.EC2.Model.VgwTelemetry}
VpnConnectionId              : vpn-12345678
VpnGatewayId                 : vgw-1a2b3c4d
```
**Contoh 2: Contoh ini menjelaskan koneksi VPN apa pun yang statusnya tertunda atau tersedia.**  

```
$filter = New-Object Amazon.EC2.Model.Filter
$filter.Name = "state"
$filter.Values = @( "pending", "available" )

Get-EC2VpnConnection -Filter $filter
```
**Contoh 3: Contoh ini menjelaskan semua koneksi VPN Anda.**  

```
Get-EC2VpnConnection
```
+  Untuk detail API, lihat [DescribeVpnConnections](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Get-EC2VpnGateway`
<a name="ec2_DescribeVpnGateways_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Get-EC2VpnGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menjelaskan gateway pribadi virtual yang ditentukan.**  

```
Get-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d
```
**Output:**  

```
AvailabilityZone :
State            : available
Tags             : {}
Type             : ipsec.1
VpcAttachments   : {vpc-12345678}
VpnGatewayId     : vgw-1a2b3c4d
```
**Contoh 2: Contoh ini menjelaskan gateway pribadi virtual yang statusnya tertunda atau tersedia.**  

```
$filter = New-Object Amazon.EC2.Model.Filter
$filter.Name = "state"
$filter.Values = @( "pending", "available" )

Get-EC2VpnGateway -Filter $filter
```
**Contoh 3: Contoh ini menjelaskan semua gateway pribadi virtual Anda.**  

```
Get-EC2VpnGateway
```
+  Untuk detail API, lihat [DescribeVpnGateways](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Grant-EC2SecurityGroupEgress`
<a name="ec2_AuthorizeSecurityGroupEgress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Grant-EC2SecurityGroupEgress`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mendefinisikan aturan jalan keluar untuk grup keamanan yang ditentukan untuk EC2-VPC. Aturan memberikan akses ke rentang alamat IP yang ditentukan pada port TCP 80. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
$ip = @{ IpProtocol="tcp"; FromPort="80"; ToPort="80"; IpRanges="203.0.113.0/24" }
Grant-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission $ip
```
**Contoh 2: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat objek. IpPermission **  

```
$ip = New-Object Amazon.EC2.Model.IpPermission
$ip.IpProtocol = "tcp"
$ip.FromPort = 80
$ip.ToPort = 80
$ip.IpRanges.Add("203.0.113.0/24")

Grant-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission $ip
```
**Contoh 3: Contoh ini memberikan akses ke grup keamanan sumber yang ditentukan pada port TCP 80.**  

```
$ug = New-Object Amazon.EC2.Model.UserIdGroupPair
$ug.GroupId = "sg-1a2b3c4d"
$ug.UserId = "123456789012"

Grant-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission @( @{ IpProtocol="tcp"; FromPort="80"; ToPort="80"; UserIdGroupPairs=$ug } )
```
+  Untuk detail API, lihat [AuthorizeSecurityGroupEgress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Grant-EC2SecurityGroupIngress`
<a name="ec2_AuthorizeSecurityGroupIngress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Grant-EC2SecurityGroupIngress`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mendefinisikan aturan masuk untuk grup keamanan untuk EC2-VPC. Aturan ini memberikan akses ke alamat IP tertentu untuk SSH (port 22) dan RDC (port 3389). Perhatikan bahwa Anda harus mengidentifikasi grup keamanan untuk EC2-VPC menggunakan ID grup keamanan bukan nama grup keamanan. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
$ip1 = @{ IpProtocol="tcp"; FromPort="22"; ToPort="22"; IpRanges="203.0.113.25/32" }
$ip2 = @{ IpProtocol="tcp"; FromPort="3389"; ToPort="3389"; IpRanges="203.0.113.25/32" }

Grant-EC2SecurityGroupIngress -GroupId sg-12345678 -IpPermission @( $ip1, $ip2 )
```
**Contoh 2: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat objek. IpPermission **  

```
$ip1 = New-Object Amazon.EC2.Model.IpPermission
$ip1.IpProtocol = "tcp"
$ip1.FromPort = 22
$ip1.ToPort = 22
$ip1.IpRanges.Add("203.0.113.25/32")

$ip2 = new-object Amazon.EC2.Model.IpPermission
$ip2.IpProtocol = "tcp"
$ip2.FromPort = 3389
$ip2.ToPort = 3389
$ip2.IpRanges.Add("203.0.113.25/32")

Grant-EC2SecurityGroupIngress -GroupId sg-12345678 -IpPermission @( $ip1, $ip2 )
```
**Contoh 3: Contoh ini mendefinisikan aturan ingress untuk grup keamanan untuk EC2-Classic. Aturan ini memberikan akses ke alamat IP tertentu untuk SSH (port 22) dan RDC (port 3389). Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
$ip1 = @{ IpProtocol="tcp"; FromPort="22"; ToPort="22"; IpRanges="203.0.113.25/32" }
$ip2 = @{ IpProtocol="tcp"; FromPort="3389"; ToPort="3389"; IpRanges="203.0.113.25/32" }

Grant-EC2SecurityGroupIngress -GroupName "my-security-group" -IpPermission @( $ip1, $ip2 )
```
**Contoh 4: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat objek. IpPermission **  

```
$ip1 = New-Object Amazon.EC2.Model.IpPermission
$ip1.IpProtocol = "tcp"
$ip1.FromPort = 22
$ip1.ToPort = 22
$ip1.IpRanges.Add("203.0.113.25/32")

$ip2 = new-object Amazon.EC2.Model.IpPermission
$ip2.IpProtocol = "tcp"
$ip2.FromPort = 3389
$ip2.ToPort = 3389
$ip2.IpRanges.Add("203.0.113.25/32")

Grant-EC2SecurityGroupIngress -GroupName "my-security-group" -IpPermission @( $ip1, $ip2 )
```
**Contoh 5: Contoh ini memberikan akses port TCP 8081 dari grup keamanan sumber tertentu (sg-1a2b3c4d) ke grup keamanan yang ditentukan (sg-12345678).**  

```
$ug = New-Object Amazon.EC2.Model.UserIdGroupPair
$ug.GroupId = "sg-1a2b3c4d"
$ug.UserId = "123456789012"

Grant-EC2SecurityGroupIngress -GroupId sg-12345678 -IpPermission @( @{ IpProtocol="tcp"; FromPort="8081"; ToPort="8081"; UserIdGroupPairs=$ug } )
```
**Contoh 6: Contoh ini menambahkan CIDR 5.5.5.5/32 ke aturan Ingress dari Grup keamanan sg-1234abcd untuk lalu lintas port TCP 22 dengan deskripsi.**  

```
$IpRange = New-Object -TypeName Amazon.EC2.Model.IpRange
$IpRange.CidrIp = "5.5.5.5/32"
$IpRange.Description = "SSH from Office"
$IpPermission = New-Object Amazon.EC2.Model.IpPermission
$IpPermission.IpProtocol = "tcp"
$IpPermission.ToPort = 22
$IpPermission.FromPort = 22
$IpPermission.Ipv4Ranges = $IpRange
Grant-EC2SecurityGroupIngress -GroupId sg-1234abcd -IpPermission $IpPermission
```
+  Untuk detail API, lihat [AuthorizeSecurityGroupIngress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Import-EC2Image`
<a name="ec2_ImportImage_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Import-EC2Image`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengimpor image mesin virtual disk tunggal dari bucket Amazon S3 yang ditentukan ke Amazon EC2 dengan token idempotensi. Contoh ini mengharuskan Peran Layanan Impor VM dengan nama default 'vmimport' ada, dengan kebijakan yang mengizinkan akses Amazon EC2 ke bucket yang ditentukan, seperti yang dijelaskan dalam topik Prekuisisi Impor VM. Untuk menggunakan peran kustom, tentukan nama peran menggunakan `-RoleName` parameter.**  

```
$container = New-Object Amazon.EC2.Model.ImageDiskContainer
$container.Format="VMDK"
$container.UserBucket = New-Object Amazon.EC2.Model.UserBucket
$container.UserBucket.S3Bucket = "amzn-s3-demo-bucket"
$container.UserBucket.S3Key = "Win_2008_Server_Standard_SP2_64-bit-disk1.vmdk"

$parms = @{
    "ClientToken"="idempotencyToken"
    "Description"="Windows 2008 Standard Image Import"
    "Platform"="Windows"
    "LicenseType"="AWS"
}

Import-EC2Image -DiskContainer $container @parms
```
**Output:**  

```
Architecture    : 
Description     : Windows 2008 Standard Image
Hypervisor      : 
ImageId         : 
ImportTaskId    : import-ami-abcdefgh
LicenseType     : AWS
Platform        : Windows
Progress        : 2
SnapshotDetails : {}
Status          : active
StatusMessage   : pending
```
+  Untuk detail API, lihat [ImportImage](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Import-EC2KeyPair`
<a name="ec2_ImportKeyPair_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Import-EC2KeyPair`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengimpor kunci publik ke EC2. Baris pertama menyimpan isi file kunci publik (\$1.pub) dalam variabel. `$publickey` Selanjutnya, contoh mengkonversi UTF8 format file kunci publik ke string Base64-encoded, dan menyimpan string dikonversi dalam variabel. `$pkbase64` Pada baris terakhir, kunci publik yang dikonversi diimpor ke EC2. Cmdlet mengembalikan sidik jari kunci dan nama sebagai hasil.**  

```
$publickey=[Io.File]::ReadAllText("C:\Users\TestUser\.ssh\id_rsa.pub")
$pkbase64 = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($publickey))
Import-EC2KeyPair -KeyName Example-user-key -PublicKey $pkbase64
```
**Output:**  

```
KeyFingerprint                                  KeyName
--------------                                  -------
do:d0:15:8f:79:97:12:be:00:fd:df:31:z3:b1:42:z1 Example-user-key
```
+  Untuk detail API, lihat [ImportKeyPair](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Import-EC2Snapshot`
<a name="ec2_ImportSnapshot_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Import-EC2Snapshot`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengimpor image disk VM format 'VMDK' ke snapshot Amazon EBS. Contoh ini memerlukan Peran Layanan Impor VM dengan nama default 'vmimport', dengan kebijakan yang mengizinkan akses Amazon EC2 ke bucket yang ditentukan, seperti yang dijelaskan dalam topik di http://docs.aws.amazon. `VM Import Prequisites` com/AWSEC2/latest/WindowsGuide/VMImportPrerequisites.html. Untuk menggunakan peran kustom, tentukan nama peran menggunakan `-RoleName` parameter.**  

```
$parms = @{
    "ClientToken"="idempotencyToken"
    "Description"="Disk Image Import"
    "DiskContainer_Description" = "Data disk"
    "DiskContainer_Format" = "VMDK"
    "DiskContainer_S3Bucket" = "amzn-s3-demo-bucket"
    "DiskContainer_S3Key" = "datadiskimage.vmdk"
}

Import-EC2Snapshot @parms
```
**Output:**  

```
Description            ImportTaskId               SnapshotTaskDetail                                                          
-----------------      --------------------       ------------------                                                          
Disk Image Import      import-snap-abcdefgh       Amazon.EC2.Model.SnapshotTaskDetail
```
+  Untuk detail API, lihat [ImportSnapshot](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Move-EC2AddressToVpc`
<a name="ec2_MoveAddressToVpc_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Move-EC2AddressToVpc`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memindahkan instans EC2 dengan alamat IP publik 12.345.67.89 ke platform EC2-VPC di wilayah AS Timur (Virginia Utara).**  

```
Move-EC2AddressToVpc -PublicIp 12.345.67.89 -Region us-east-1
```
**Contoh 2: Contoh ini menyalurkan hasil Get-EC2Instance perintah ke Move-EC2AddressToVpc cmdlet. Get-EC2InstancePerintah mendapat instance yang ditentukan oleh ID instance, kemudian mengembalikan properti alamat IP publik dari instance tersebut.**  

```
(Get-EC2Instance -Instance i-12345678).Instances.PublicIpAddress | Move-EC2AddressToVpc
```
+  Untuk detail API, lihat [MoveAddressToVpc](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Address`
<a name="ec2_AllocateAddress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Address`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengalokasikan alamat IP Elastis untuk digunakan dengan instance di VPC.**  

```
New-EC2Address -Domain Vpc
```
**Output:**  

```
AllocationId         Domain      PublicIp
------------         ------      --------
eipalloc-12345678    vpc         198.51.100.2
```
**Contoh 2: Contoh ini mengalokasikan alamat IP Elastis untuk digunakan dengan instance di EC2-Classic.**  

```
New-EC2Address
```
**Output:**  

```
AllocationId         Domain      PublicIp
------------         ------      --------
                     standard    203.0.113.17
```
+  Untuk detail API, lihat [AllocateAddress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2CustomerGateway`
<a name="ec2_CreateCustomerGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2CustomerGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat gateway pelanggan yang ditentukan.**  

```
New-EC2CustomerGateway -Type ipsec.1 -PublicIp 203.0.113.12 -BgpAsn 65534
```
**Output:**  

```
BgpAsn            : 65534
CustomerGatewayId : cgw-1a2b3c4d
IpAddress         : 203.0.113.12
State             : available
Tags              : {}
Type              : ipsec.1
```
+  Untuk detail API, lihat [CreateCustomerGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2DhcpOption`
<a name="ec2_CreateDhcpOptions_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2DhcpOption`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menciptakan kumpulan opsi DHCP yang ditentukan. Sintaks yang digunakan oleh contoh ini memerlukan PowerShell versi 3 atau yang lebih baru.**  

```
$options = @( @{Key="domain-name";Values=@("abc.local")}, @{Key="domain-name-servers";Values=@("10.0.0.101","10.0.0.102")})
New-EC2DhcpOption -DhcpConfiguration $options
```
**Output:**  

```
DhcpConfigurations                    DhcpOptionsId    Tags
------------------                    -------------    ----
{domain-name, domain-name-servers}    dopt-1a2b3c4d    {}
```
**Contoh 2: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat setiap opsi DHCP.**  

```
$option1 = New-Object Amazon.EC2.Model.DhcpConfiguration
$option1.Key = "domain-name"
$option1.Values = "abc.local"

$option2 = New-Object Amazon.EC2.Model.DhcpConfiguration
$option2.Key = "domain-name-servers"
$option2.Values = @("10.0.0.101","10.0.0.102")

New-EC2DhcpOption -DhcpConfiguration @($option1, $option2)
```
**Output:**  

```
DhcpConfigurations                    DhcpOptionsId    Tags
------------------                    -------------    ----
{domain-name, domain-name-servers}    dopt-2a3b4c5d    {}
```
+  Untuk detail API, lihat [CreateDhcpOptions](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2FlowLog`
<a name="ec2_CreateFlowLogs_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2FlowLog`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat flowlog EC2 untuk subnet subnet-1d234567 ke 'subnet1-log' cloud-watch-log bernama untuk semua lalu lintas 'TOLAK' menggunakan batas peran 'Admin'**  

```
New-EC2FlowLog -ResourceId "subnet-1d234567" -LogDestinationType cloud-watch-logs -LogGroupName subnet1-log -TrafficType "REJECT" -ResourceType Subnet -DeliverLogsPermissionArn "arn:aws:iam::98765432109:role/Admin"
```
**Output:**  

```
ClientToken                                  FlowLogIds             Unsuccessful
-----------                                  ----------             ------------
m1VN2cxP3iB4qo//VUKl5EU6cF7gQLOxcqNefvjeTGw= {fl-012fc34eed5678c9d} {}
```
+  Untuk detail API, lihat [CreateFlowLogs](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Host`
<a name="ec2_AllocateHosts_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Host`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengalokasikan Host Khusus ke akun Anda untuk jenis instans dan zona ketersediaan yang diberikan**  

```
New-EC2Host -AutoPlacement on -AvailabilityZone eu-west-1b -InstanceType m4.xlarge -Quantity 1
```
**Output:**  

```
h-01e23f4cd567890f3
```
+  Untuk detail API, lihat [AllocateHosts](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2HostReservation`
<a name="ec2_PurchaseHostReservation_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2HostReservation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membeli reservasi yang menawarkan hro-0c1f23456789d0ab dengan konfigurasi yang cocok dengan Host Khusus Anda h-01e23f4cd567890f1**  

```
New-EC2HostReservation -OfferingId hro-0c1f23456789d0ab HostIdSet h-01e23f4cd567890f1
```
**Output:**  

```
ClientToken       :
CurrencyCode      :
Purchase          : {hr-0123f4b5d67bedc89}
TotalHourlyPrice  : 1.307
TotalUpfrontPrice : 0.000
```
+  Untuk detail API, lihat [PurchaseHostReservation](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Image`
<a name="ec2_CreateImage_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Image`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat AMI dengan nama dan deskripsi yang ditentukan, dari instance yang ditentukan. Amazon EC2 mencoba mematikan instance dengan bersih sebelum membuat gambar, dan memulai ulang instance setelah selesai.**  

```
New-EC2Image -InstanceId i-12345678 -Name "my-web-server" -Description "My web server AMI"
```
**Contoh 2: Contoh ini membuat AMI dengan nama dan deskripsi yang ditentukan, dari instance yang ditentukan. Amazon EC2 membuat gambar tanpa mematikan dan memulai ulang instance; oleh karena itu, integritas sistem file pada gambar yang dibuat tidak dapat dijamin.**  

```
New-EC2Image -InstanceId i-12345678 -Name "my-web-server" -Description "My web server AMI" -NoReboot $true
```
**Contoh 3: Contoh ini membuat AMI dengan tiga volume. Volume pertama didasarkan pada snapshot Amazon EBS. Volume kedua adalah volume 100 GiB Amazon EBS kosong. Volume ketiga adalah volume penyimpanan instance. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
$ebsBlock1 = @{SnapshotId="snap-1a2b3c4d"}
$ebsBlock2 = @{VolumeSize=100}

New-EC2Image -InstanceId i-12345678 -Name "my-web-server" -Description "My web server AMI" -BlockDeviceMapping @( @{DeviceName="/dev/sdf";Ebs=$ebsBlock1}, @{DeviceName="/dev/sdg";Ebs=$ebsBlock2}, @{DeviceName="/dev/sdc";VirtualName="ephemeral0"})
```
+  Untuk detail API, lihat [CreateImage](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Instance`
<a name="ec2_RunInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Instance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini meluncurkan satu instance dari AMI yang ditentukan di EC2-Classic atau VPC default.**  

```
New-EC2Instance -ImageId ami-12345678 -MinCount 1 -MaxCount 1 -InstanceType m3.medium -KeyName my-key-pair -SecurityGroup my-security-group
```
**Contoh 2: Contoh ini meluncurkan satu instance dari AMI yang ditentukan dalam VPC.**  

```
New-EC2Instance -ImageId ami-12345678 -MinCount 1 -MaxCount 1 -SubnetId subnet-12345678 -InstanceType t2.micro -KeyName my-key-pair -SecurityGroupId sg-12345678
```
**Contoh 3: Untuk menambahkan volume EBS atau volume penyimpanan instance, tentukan pemetaan perangkat blok dan tambahkan ke perintah. Contoh ini menambahkan volume penyimpanan instance.**  

```
$bdm = New-Object Amazon.EC2.Model.BlockDeviceMapping
$bdm.VirtualName = "ephemeral0"
$bdm.DeviceName = "/dev/sdf"

New-EC2Instance -ImageId ami-12345678 -BlockDeviceMapping $bdm ...
```
**Contoh 4: Untuk menentukan salah satu Windows saat ini AMIs, dapatkan ID AMI menggunakanGet-EC2ImageByName. Contoh ini meluncurkan instance dari basis AMI saat ini untuk Windows Server 2016.**  

```
$ami = Get-EC2ImageByName WINDOWS_2016_BASE

New-EC2Instance -ImageId $ami.ImageId ...
```
**Contoh 5: Meluncurkan instance ke lingkungan host khusus yang ditentukan.**  

```
New-EC2Instance -ImageId ami-1a2b3c4d -InstanceType m4.large -KeyName my-key-pair -SecurityGroupId sg-1a2b3c4d  -AvailabilityZone us-west-1a -Tenancy host -HostID h-1a2b3c4d5e6f1a2b3
```
**Contoh 6: Permintaan ini meluncurkan dua instance dan menerapkan tag dengan kunci server web dan nilai produksi ke instance. Permintaan juga menerapkan tag dengan kunci cost-center dan nilai cc123 ke volume yang dibuat (dalam hal ini, volume root untuk setiap instance).**  

```
$tag1 = @{ Key="webserver"; Value="production" }
$tag2 = @{ Key="cost-center"; Value="cc123" }

$tagspec1 = new-object Amazon.EC2.Model.TagSpecification
$tagspec1.ResourceType = "instance"
$tagspec1.Tags.Add($tag1)

$tagspec2 = new-object Amazon.EC2.Model.TagSpecification
$tagspec2.ResourceType = "volume"
$tagspec2.Tags.Add($tag2)

New-EC2Instance -ImageId "ami-1a2b3c4d" -KeyName "my-key-pair" -MaxCount 2 -InstanceType "t2.large" -SubnetId "subnet-1a2b3c4d" -TagSpecification $tagspec1,$tagspec2
```
+  Untuk detail API, lihat [RunInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2InstanceExportTask`
<a name="ec2_CreateInstanceExportTask_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2InstanceExportTask`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengekspor instance yang dihentikan,`i-0800b00a00EXAMPLE`, sebagai hard disk virtual (VHD) ke bucket S3. `testbucket-export-instances-2019` Lingkungan target adalah`Microsoft`, dan parameter wilayah ditambahkan karena instance ada di `us-east-1` wilayah, sedangkan AWS Wilayah default pengguna bukan us-east-1. Untuk mendapatkan status tugas ekspor, salin `ExportTaskId` nilai dari hasil perintah ini, lalu jalankan `Get-EC2ExportTask -ExportTaskId export_task_ID_from_results.`**  

```
New-EC2InstanceExportTask -InstanceId i-0800b00a00EXAMPLE -ExportToS3Task_DiskImageFormat VHD -ExportToS3Task_S3Bucket "amzn-s3-demo-bucket" -TargetEnvironment Microsoft -Region us-east-1
```
**Output:**  

```
Description           : 
ExportTaskId          : export-i-077c73108aEXAMPLE
ExportToS3Task        : Amazon.EC2.Model.ExportToS3Task
InstanceExportDetails : Amazon.EC2.Model.InstanceExportDetails
State                 : active
StatusMessage         :
```
+  Untuk detail API, lihat [CreateInstanceExportTask](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2InternetGateway`
<a name="ec2_CreateInternetGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2InternetGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat gateway Internet.**  

```
New-EC2InternetGateway
```
**Output:**  

```
Attachments    InternetGatewayId    Tags
-----------    -----------------    ----
{}             igw-1a2b3c4d         {}
```
+  Untuk detail API, lihat [CreateInternetGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2KeyPair`
<a name="ec2_CreateKeyPair_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2KeyPair`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat key pair dan menangkap kunci pribadi RSA yang dikodekan PEM dalam file dengan nama yang ditentukan. Saat Anda menggunakan PowerShell, pengkodean harus diatur ke ascii untuk menghasilkan kunci yang valid. Untuk informasi selengkapnya, lihat Membuat, Menampilkan, dan Menghapus Pasangan Kunci Amazon EC2 (https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-keypairs.html) di Panduan Pengguna Antarmuka Baris AWS Perintah.**  

```
(New-EC2KeyPair -KeyName "my-key-pair").KeyMaterial | Out-File -Encoding ascii -FilePath C:\path\my-key-pair.pem
```
+  Untuk detail API, lihat [CreateKeyPair](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2NetworkAcl`
<a name="ec2_CreateNetworkAcl_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2NetworkAcl`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat ACL jaringan untuk VPC yang ditentukan.**  

```
New-EC2NetworkAcl -VpcId vpc-12345678
```
**Output:**  

```
Associations : {}
Entries      : {Amazon.EC2.Model.NetworkAclEntry, Amazon.EC2.Model.NetworkAclEntry}
IsDefault    : False
NetworkAclId : acl-12345678
Tags         : {}
VpcId        : vpc-12345678
```
+  Untuk detail API, lihat [CreateNetworkAcl](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2NetworkAclEntry`
<a name="ec2_CreateNetworkAclEntry_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2NetworkAclEntry`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat entri untuk ACL jaringan tertentu. Aturan ini memungkinkan lalu lintas masuk dari mana saja (0.0.0.0/0) pada port UDP 53 (DNS) ke subnet terkait.**  

```
New-EC2NetworkAclEntry -NetworkAclId acl-12345678 -Egress $false -RuleNumber 100 -Protocol 17 -PortRange_From 53 -PortRange_To 53 -CidrBlock 0.0.0.0/0 -RuleAction allow
```
+  Untuk detail API, lihat [CreateNetworkAclEntry](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2NetworkInterface`
<a name="ec2_CreateNetworkInterface_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2NetworkInterface`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menciptakan antarmuka jaringan yang ditentukan.**  

```
New-EC2NetworkInterface -SubnetId subnet-1a2b3c4d -Description "my network interface" -Group sg-12345678 -PrivateIpAddress 10.0.0.17
```
**Output:**  

```
Association        :
Attachment         :
AvailabilityZone   : us-west-2c
Description        : my network interface
Groups             : {my-security-group}
MacAddress         : 0a:72:bc:1a:cd:7f
NetworkInterfaceId : eni-12345678
OwnerId            : 123456789012
PrivateDnsName     : ip-10-0-0-17.us-west-2.compute.internal
PrivateIpAddress   : 10.0.0.17
PrivateIpAddresses : {}
RequesterId        :
RequesterManaged   : False
SourceDestCheck    : True
Status             : pending
SubnetId           : subnet-1a2b3c4d
TagSet             : {}
VpcId              : vpc-12345678
```
+  Untuk detail API, lihat [CreateNetworkInterface](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2PlacementGroup`
<a name="ec2_CreatePlacementGroup_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2PlacementGroup`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat grup penempatan dengan nama yang ditentukan.**  

```
New-EC2PlacementGroup -GroupName my-placement-group -Strategy cluster
```
+  Untuk detail API, lihat [CreatePlacementGroup](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Route`
<a name="ec2_CreateRoute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Route`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menciptakan rute yang ditentukan untuk tabel rute yang ditentukan. Rute cocok dengan semua lalu lintas dan mengirimkannya ke gateway Internet yang ditentukan.**  

```
New-EC2Route -RouteTableId rtb-1a2b3c4d -DestinationCidrBlock 0.0.0.0/0 -GatewayId igw-1a2b3c4d
```
**Output:**  

```
True
```
+  Untuk detail API, lihat [CreateRoute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2RouteTable`
<a name="ec2_CreateRouteTable_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2RouteTable`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat tabel rute untuk VPC yang ditentukan.**  

```
New-EC2RouteTable -VpcId vpc-12345678
```
**Output:**  

```
Associations    : {}
PropagatingVgws : {}
Routes          : {}
RouteTableId    : rtb-1a2b3c4d
Tags            : {}
VpcId           : vpc-12345678
```
+  Untuk detail API, lihat [CreateRouteTable](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2ScheduledInstance`
<a name="ec2_RunScheduledInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2ScheduledInstance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini meluncurkan Instance Terjadwal yang ditentukan.**  

```
New-EC2ScheduledInstance -ScheduledInstanceId sci-1234-1234-1234-1234-123456789012 -InstanceCount 1 `
-IamInstanceProfile_Name my-iam-role `
-LaunchSpecification_ImageId ami-12345678 `
-LaunchSpecification_InstanceType c4.large `
-LaunchSpecification_SubnetId subnet-12345678`
-LaunchSpecification_SecurityGroupId sg-12345678
```
+  Untuk detail API, lihat [RunScheduledInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2ScheduledInstancePurchase`
<a name="ec2_PurchaseScheduledInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2ScheduledInstancePurchase`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membeli Instance Terjadwal.**  

```
$request = New-Object Amazon.EC2.Model.PurchaseRequest
$request.InstanceCount = 1
$request.PurchaseToken = "eyJ2IjoiMSIsInMiOjEsImMiOi..."
New-EC2ScheduledInstancePurchase -PurchaseRequest $request
```
**Output:**  

```
AvailabilityZone            : us-west-2b
CreateDate                  : 1/25/2016 1:43:38 PM
HourlyPrice                 : 0.095
InstanceCount               : 1
InstanceType                : c4.large
NetworkPlatform             : EC2-VPC
NextSlotStartTime           : 1/31/2016 1:00:00 AM
Platform                    : Linux/UNIX
PreviousSlotEndTime         : 
Recurrence                  : Amazon.EC2.Model.ScheduledInstanceRecurrence
ScheduledInstanceId         : sci-1234-1234-1234-1234-123456789012
SlotDurationInHours         : 32
TermEndDate                 : 1/31/2017 1:00:00 AM
TermStartDate               : 1/31/2016 1:00:00 AM
TotalScheduledInstanceHours : 1696
```
+  Untuk detail API, lihat [PurchaseScheduledInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2SecurityGroup`
<a name="ec2_CreateSecurityGroup_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2SecurityGroup`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat grup keamanan untuk VPC yang ditentukan.**  

```
New-EC2SecurityGroup -GroupName my-security-group -Description "my security group" -VpcId vpc-12345678
```
**Output:**  

```
sg-12345678
```
**Contoh 2: Contoh ini membuat grup keamanan untuk EC2-Classic.**  

```
New-EC2SecurityGroup -GroupName my-security-group -Description "my security group"
```
**Output:**  

```
sg-45678901
```
+  Untuk detail API, lihat [CreateSecurityGroup](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Snapshot`
<a name="ec2_CreateSnapshot_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Snapshot`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat snapshot dari volume yang ditentukan.**  

```
New-EC2Snapshot -VolumeId vol-12345678 -Description "This is a test"
```
**Output:**  

```
DataEncryptionKeyId :
Description         : This is a test
Encrypted           : False
KmsKeyId            :
OwnerAlias          :
OwnerId             : 123456789012
Progress            :
SnapshotId          : snap-12345678
StartTime           : 12/22/2015 1:28:42 AM
State               : pending
StateMessage        :
Tags                : {}
VolumeId            : vol-12345678
VolumeSize          : 20
```
+  Untuk detail API, lihat [CreateSnapshot](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2SpotDatafeedSubscription`
<a name="ec2_CreateSpotDatafeedSubscription_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2SpotDatafeedSubscription`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat umpan data instance Spot.**  

```
New-EC2SpotDatafeedSubscription -Bucket amzn-s3-demo-bucket -Prefix spotdata
```
**Output:**  

```
Bucket  : amzn-s3-demo-bucket
Fault   :
OwnerId : 123456789012
Prefix  : spotdata
State   : Active
```
+  Untuk detail API, lihat [CreateSpotDatafeedSubscription](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Subnet`
<a name="ec2_CreateSubnet_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Subnet`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat subnet dengan CIDR yang ditentukan.**  

```
New-EC2Subnet -VpcId vpc-12345678 -CidrBlock 10.0.0.0/24
```
**Output:**  

```
AvailabilityZone        : us-west-2c
AvailableIpAddressCount : 251
CidrBlock               : 10.0.0.0/24
DefaultForAz            : False
MapPublicIpOnLaunch     : False
State                   : pending
SubnetId                : subnet-1a2b3c4d
Tag                     : {}
VpcId                   : vpc-12345678
```
+  Untuk detail API, lihat [CreateSubnet](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Tag`
<a name="ec2_CreateTags_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Tag`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menambahkan satu tag ke sumber daya yang ditentukan. Kunci tag adalah 'MyTag' dan nilai tag adalah 'myTagValue'. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
New-EC2Tag -Resource i-12345678 -Tag @{ Key="myTag"; Value="myTagValue" }
```
**Contoh 2: Contoh ini memperbarui atau menambahkan tag yang ditentukan ke sumber daya yang ditentukan. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
New-EC2Tag -Resource i-12345678 -Tag @( @{ Key="myTag"; Value="newTagValue" }, @{ Key="test"; Value="anotherTagValue" } )
```
**Contoh 3: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat tag untuk parameter Tag.**  

```
$tag = New-Object Amazon.EC2.Model.Tag
$tag.Key = "myTag"
$tag.Value = "myTagValue"

New-EC2Tag -Resource i-12345678 -Tag $tag
```
+  Untuk detail API, lihat [CreateTags](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Volume`
<a name="ec2_CreateVolume_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Volume`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menciptakan volume yang ditentukan.**  

```
New-EC2Volume -Size 50 -AvailabilityZone us-west-2a -VolumeType gp2
```
**Output:**  

```
Attachments      : {}
AvailabilityZone : us-west-2a
CreateTime       : 12/22/2015 1:42:07 AM
Encrypted        : False
Iops             : 150
KmsKeyId         :
Size             : 50
SnapshotId       :
State            : creating
Tags             : {}
VolumeId         : vol-12345678
VolumeType       : gp2
```
**Contoh 2: Permintaan contoh ini membuat volume dan menerapkan tag dengan kunci tumpukan dan nilai produksi.**  

```
$tag = @{ Key="stack"; Value="production" }

$tagspec = new-object Amazon.EC2.Model.TagSpecification
$tagspec.ResourceType = "volume"
$tagspec.Tags.Add($tag)

New-EC2Volume -Size 80 -AvailabilityZone "us-west-2a" -TagSpecification $tagspec
```
+  Untuk detail API, lihat [CreateVolume](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2Vpc`
<a name="ec2_CreateVpc_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2Vpc`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat VPC dengan CIDR yang ditentukan. Amazon VPC juga membuat yang berikut untuk VPC: set opsi DHCP default, tabel rute utama, dan ACL jaringan default.**  

```
New-EC2VPC -CidrBlock 10.0.0.0/16
```
**Output:**  

```
CidrBlock       : 10.0.0.0/16
DhcpOptionsId   : dopt-1a2b3c4d
InstanceTenancy : default
IsDefault       : False
State           : pending
Tags            : {}
VpcId           : vpc-12345678
```
+  Untuk detail API, lihat [CreateVpc](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2VpcEndpoint`
<a name="ec2_CreateVpcEndpoint_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2VpcEndpoint`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat Endpoint VPC baru untuk layanan com.amazonaws.eu-west-1.s3 di VPC vpc-0fc1ff23f45b678eb**  

```
New-EC2VpcEndpoint -ServiceName com.amazonaws.eu-west-1.s3 -VpcId vpc-0fc1ff23f45b678eb
```
**Output:**  

```
ClientToken VpcEndpoint
----------- -----------
            Amazon.EC2.Model.VpcEndpoint
```
+  Untuk detail API, lihat [CreateVpcEndpoint](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2VpnConnection`
<a name="ec2_CreateVpnConnection_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2VpnConnection`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat koneksi VPN antara gateway pribadi virtual yang ditentukan dan gateway pelanggan yang ditentukan. Outputnya mencakup informasi konfigurasi yang dibutuhkan administrator jaringan Anda, dalam format XHTML.**  

```
New-EC2VpnConnection -Type ipsec.1 -CustomerGatewayId cgw-1a2b3c4d -VpnGatewayId vgw-1a2b3c4d
```
**Output:**  

```
CustomerGatewayConfiguration : [XML document]
CustomerGatewayId            : cgw-1a2b3c4d
Options                      :
Routes                       : {}
State                        : pending
Tags                         : {}
Type                         :
VgwTelemetry                 : {}
VpnConnectionId              : vpn-12345678
VpnGatewayId                 : vgw-1a2b3c4d
```
**Contoh 2: Contoh ini membuat koneksi VPN dan menangkap konfigurasi dalam file dengan nama yang ditentukan.**  

```
(New-EC2VpnConnection -CustomerGatewayId cgw-1a2b3c4d -VpnGatewayId vgw-1a2b3c4d).CustomerGatewayConfiguration | Out-File C:\path\vpn-configuration.xml
```
**Contoh 3: Contoh ini membuat koneksi VPN, dengan perutean statis, antara gateway pribadi virtual yang ditentukan dan gateway pelanggan yang ditentukan.**  

```
New-EC2VpnConnection -Type ipsec.1 -CustomerGatewayId cgw-1a2b3c4d -VpnGatewayId vgw-1a2b3c4d -Options_StaticRoutesOnly $true
```
+  Untuk detail API, lihat [CreateVpnConnection](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2VpnConnectionRoute`
<a name="ec2_CreateVpnConnectionRoute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2VpnConnectionRoute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat rute statis yang ditentukan untuk koneksi VPN yang ditentukan.**  

```
New-EC2VpnConnectionRoute -VpnConnectionId vpn-12345678 -DestinationCidrBlock 11.12.0.0/16
```
+  Untuk detail API, lihat [CreateVpnConnectionRoute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `New-EC2VpnGateway`
<a name="ec2_CreateVpnGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`New-EC2VpnGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat gateway pribadi virtual yang ditentukan.**  

```
New-EC2VpnGateway -Type ipsec.1
```
**Output:**  

```
AvailabilityZone :
State            : available
Tags             : {}
Type             : ipsec.1
VpcAttachments   : {}
VpnGatewayId     : vgw-1a2b3c4d
```
+  Untuk detail API, lihat [CreateVpnGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Register-EC2Address`
<a name="ec2_AssociateAddress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-EC2Address`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengaitkan alamat IP Elastis yang ditentukan dengan instance yang ditentukan dalam VPC.**  

```
C:\> Register-EC2Address -InstanceId i-12345678 -AllocationId eipalloc-12345678
```
**Output:**  

```
eipassoc-12345678
```
**Contoh 2: Contoh ini mengaitkan alamat IP Elastis yang ditentukan dengan instance yang ditentukan di EC2-Classic.**  

```
C:\> Register-EC2Address -InstanceId i-12345678 -PublicIp 203.0.113.17
```
+  Untuk detail API, lihat [AssociateAddress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Register-EC2DhcpOption`
<a name="ec2_AssociateDhcpOptions_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-EC2DhcpOption`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengaitkan opsi DHCP tertentu yang ditetapkan dengan VPC yang ditentukan.**  

```
Register-EC2DhcpOption -DhcpOptionsId dopt-1a2b3c4d -VpcId vpc-12345678
```
**Contoh 2: Contoh ini mengaitkan opsi DHCP default yang ditetapkan dengan VPC yang ditentukan.**  

```
Register-EC2DhcpOption -DhcpOptionsId default -VpcId vpc-12345678
```
+  Untuk detail API, lihat [AssociateDhcpOptions](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Register-EC2Image`
<a name="ec2_RegisterImage_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-EC2Image`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mendaftarkan AMI menggunakan file manifes yang ditentukan di Amazon S3.**  

```
Register-EC2Image -ImageLocation amzn-s3-demo-bucket/my-web-server-ami/image.manifest.xml -Name my-web-server-ami
```
+  Untuk detail API, lihat [RegisterImage](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Register-EC2PrivateIpAddress`
<a name="ec2_AssignPrivateIpAddresses_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-EC2PrivateIpAddress`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memberikan alamat IP pribadi sekunder yang ditentukan ke antarmuka jaringan yang ditentukan.**  

```
Register-EC2PrivateIpAddress -NetworkInterfaceId eni-1a2b3c4d -PrivateIpAddress 10.0.0.82
```
**Contoh 2: Contoh ini membuat dua alamat IP pribadi sekunder dan menetapkannya ke antarmuka jaringan yang ditentukan.**  

```
Register-EC2PrivateIpAddress -NetworkInterfaceId eni-1a2b3c4d -SecondaryPrivateIpAddressCount 2
```
+  Untuk detail API, lihat [AssignPrivateIpAddresses](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Register-EC2RouteTable`
<a name="ec2_AssociateRouteTable_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-EC2RouteTable`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengaitkan tabel rute yang ditentukan dengan subnet yang ditentukan.**  

```
Register-EC2RouteTable -RouteTableId rtb-1a2b3c4d -SubnetId subnet-1a2b3c4d
```
**Output:**  

```
rtbassoc-12345678
```
+  Untuk detail API, lihat [AssociateRouteTable](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Address`
<a name="ec2_ReleaseAddress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Address`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini merilis alamat IP Elastis yang ditentukan untuk instance di VPC.**  

```
Remove-EC2Address -AllocationId eipalloc-12345678 -Force
```
**Contoh 2: Contoh ini merilis alamat IP Elastis yang ditentukan untuk instance di EC2-Classic.**  

```
Remove-EC2Address -PublicIp 198.51.100.2 -Force
```
+  Untuk detail API, lihat [ReleaseAddress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2CapacityReservation`
<a name="ec2_CancelCapacityReservation_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2CapacityReservation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membatalkan reservasi kapasitas cr-0c1f2345db6f7cdba**  

```
Remove-EC2CapacityReservation -CapacityReservationId cr-0c1f2345db6f7cdba
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EC2CapacityReservation (CancelCapacityReservation)" on target "cr-0c1f2345db6f7cdba".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
True
```
+  Untuk detail API, lihat [CancelCapacityReservation](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2CustomerGateway`
<a name="ec2_DeleteCustomerGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2CustomerGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus gateway pelanggan yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2CustomerGateway -CustomerGatewayId cgw-1a2b3c4d
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2CustomerGateway (DeleteCustomerGateway)" on Target "cgw-1a2b3c4d".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteCustomerGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2DhcpOption`
<a name="ec2_DeleteDhcpOptions_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2DhcpOption`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus set opsi DHCP yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2DhcpOption -DhcpOptionsId dopt-1a2b3c4d
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2DhcpOption (DeleteDhcpOptions)" on Target "dopt-1a2b3c4d".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteDhcpOptions](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2FlowLog`
<a name="ec2_DeleteFlowLogs_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2FlowLog`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus FlowLogId fl-01a2b3456a789c01 yang diberikan**  

```
Remove-EC2FlowLog -FlowLogId fl-01a2b3456a789c01
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EC2FlowLog (DeleteFlowLogs)" on target "fl-01a2b3456a789c01".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
```
+  Untuk detail API, lihat [DeleteFlowLogs](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Host`
<a name="ec2_ReleaseHosts_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Host`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini merilis ID host yang diberikan h-0badafd1dcb2f3456**  

```
Remove-EC2Host -HostId h-0badafd1dcb2f3456
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EC2Host (ReleaseHosts)" on target "h-0badafd1dcb2f3456".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y

Successful            Unsuccessful
----------            ------------
{h-0badafd1dcb2f3456} {}
```
+  Untuk detail API, lihat [ReleaseHosts](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Instance`
<a name="ec2_TerminateInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Instance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengakhiri instance yang ditentukan (instance mungkin berjalan atau dalam keadaan 'berhenti'). Cmdlet akan meminta konfirmasi sebelum melanjutkan; gunakan sakelar -Force untuk menekan prompt.**  

```
Remove-EC2Instance -InstanceId i-12345678
```
**Output:**  

```
CurrentState                      InstanceId    PreviousState
------------                      ----------    -------------
Amazon.EC2.Model.InstanceState    i-12345678    Amazon.EC2.Model.InstanceState
```
+  Untuk detail API, lihat [TerminateInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2InternetGateway`
<a name="ec2_DeleteInternetGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2InternetGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus gateway Internet yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2InternetGateway -InternetGatewayId igw-1a2b3c4d
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2InternetGateway (DeleteInternetGateway)" on Target "igw-1a2b3c4d".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteInternetGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2KeyPair`
<a name="ec2_DeleteKeyPair_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2KeyPair`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus key pair yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2KeyPair -KeyName my-key-pair
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2KeyPair (DeleteKeyPair)" on Target "my-key-pair".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteKeyPair](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2NetworkAcl`
<a name="ec2_DeleteNetworkAcl_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2NetworkAcl`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus ACL jaringan tertentu. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2NetworkAcl -NetworkAclId acl-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2NetworkAcl (DeleteNetworkAcl)" on Target "acl-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteNetworkAcl](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2NetworkAclEntry`
<a name="ec2_DeleteNetworkAclEntry_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2NetworkAclEntry`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus aturan yang ditentukan dari ACL jaringan yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2NetworkAclEntry -NetworkAclId acl-12345678 -Egress $false -RuleNumber 100
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2NetworkAclEntry (DeleteNetworkAclEntry)" on Target "acl-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteNetworkAclEntry](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2NetworkInterface`
<a name="ec2_DeleteNetworkInterface_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2NetworkInterface`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus antarmuka jaringan yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2NetworkInterface -NetworkInterfaceId eni-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2NetworkInterface (DeleteNetworkInterface)" on Target "eni-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteNetworkInterface](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2PlacementGroup`
<a name="ec2_DeletePlacementGroup_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2PlacementGroup`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus grup penempatan yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2PlacementGroup -GroupName my-placement-group
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2PlacementGroup (DeletePlacementGroup)" on Target "my-placement-group".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeletePlacementGroup](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Route`
<a name="ec2_DeleteRoute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Route`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus rute yang ditentukan dari tabel rute yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2Route -RouteTableId rtb-1a2b3c4d -DestinationCidrBlock 0.0.0.0/0
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2Route (DeleteRoute)" on Target "rtb-1a2b3c4d".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteRoute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2RouteTable`
<a name="ec2_DeleteRouteTable_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2RouteTable`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus tabel rute yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2RouteTable -RouteTableId rtb-1a2b3c4d
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2RouteTable (DeleteRouteTable)" on Target "rtb-1a2b3c4d".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteRouteTable](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2SecurityGroup`
<a name="ec2_DeleteSecurityGroup_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2SecurityGroup`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus grup keamanan yang ditentukan untuk EC2-VPC. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2SecurityGroup -GroupId sg-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2SecurityGroup (DeleteSecurityGroup)" on Target "sg-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
**Contoh 2: Contoh ini menghapus grup keamanan yang ditentukan untuk EC2-Classic.**  

```
Remove-EC2SecurityGroup -GroupName my-security-group -Force
```
+  Untuk detail API, lihat [DeleteSecurityGroup](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Snapshot`
<a name="ec2_DeleteSnapshot_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Snapshot`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus snapshot yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2Snapshot -SnapshotId snap-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EC2Snapshot (DeleteSnapshot)" on target "snap-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteSnapshot](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2SpotDatafeedSubscription`
<a name="ec2_DeleteSpotDatafeedSubscription_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2SpotDatafeedSubscription`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus umpan data instans Spot Anda. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2SpotDatafeedSubscription
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2SpotDatafeedSubscription (DeleteSpotDatafeedSubscription)" on Target "".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteSpotDatafeedSubscription](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Subnet`
<a name="ec2_DeleteSubnet_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Subnet`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus subnet yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2Subnet -SubnetId subnet-1a2b3c4d
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2Subnet (DeleteSubnet)" on Target "subnet-1a2b3c4d".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteSubnet](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Tag`
<a name="ec2_DeleteTags_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Tag`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus tag yang ditentukan dari sumber daya yang ditentukan, terlepas dari nilai tag. Sintaks yang digunakan oleh contoh ini memerlukan PowerShell versi 3 atau yang lebih baru.**  

```
Remove-EC2Tag -Resource i-12345678 -Tag @{ Key="myTag" } -Force
```
**Contoh 2: Contoh ini menghapus tag yang ditentukan dari sumber daya yang ditentukan, tetapi hanya jika nilai tag cocok. Sintaks yang digunakan oleh contoh ini memerlukan PowerShell versi 3 atau yang lebih baru.**  

```
Remove-EC2Tag -Resource i-12345678 -Tag @{ Key="myTag";Value="myTagValue" } -Force
```
**Contoh 3: Contoh ini menghapus tag yang ditentukan dari sumber daya yang ditentukan, terlepas dari nilai tag.**  

```
$tag = New-Object Amazon.EC2.Model.Tag
$tag.Key = "myTag"

Remove-EC2Tag -Resource i-12345678 -Tag $tag -Force
```
**Contoh 4: Contoh ini menghapus tag yang ditentukan dari sumber daya yang ditentukan, tetapi hanya jika nilai tag cocok.**  

```
$tag = New-Object Amazon.EC2.Model.Tag
$tag.Key = "myTag"
$tag.Value = "myTagValue"

Remove-EC2Tag -Resource i-12345678 -Tag $tag -Force
```
+  Untuk detail API, lihat [DeleteTags](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Volume`
<a name="ec2_DeleteVolume_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Volume`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melepaskan volume yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2Volume -VolumeId vol-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EC2Volume (DeleteVolume)" on target "vol-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteVolume](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2Vpc`
<a name="ec2_DeleteVpc_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2Vpc`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus VPC yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2Vpc -VpcId vpc-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2Vpc (DeleteVpc)" on Target "vpc-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteVpc](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2VpnConnection`
<a name="ec2_DeleteVpnConnection_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2VpnConnection`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus koneksi VPN yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2VpnConnection -VpnConnectionId vpn-12345678
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2VpnConnection (DeleteVpnConnection)" on Target "vpn-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteVpnConnection](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2VpnConnectionRoute`
<a name="ec2_DeleteVpnConnectionRoute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2VpnConnectionRoute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus rute statis yang ditentukan dari koneksi VPN yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2VpnConnectionRoute -VpnConnectionId vpn-12345678 -DestinationCidrBlock 11.12.0.0/16
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2VpnConnectionRoute (DeleteVpnConnectionRoute)" on Target "vpn-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteVpnConnectionRoute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Remove-EC2VpnGateway`
<a name="ec2_DeleteVpnGateway_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-EC2VpnGateway`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus gateway pribadi virtual yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika Anda juga menentukan parameter Force.**  

```
Remove-EC2VpnGateway -VpnGatewayId vgw-1a2b3c4d
```
**Output:**  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2VpnGateway (DeleteVpnGateway)" on Target "vgw-1a2b3c4d".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  Untuk detail API, lihat [DeleteVpnGateway](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Request-EC2SpotFleet`
<a name="ec2_RequestSpotFleet_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Request-EC2SpotFleet`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membuat permintaan armada Spot di Availability Zone dengan harga terendah untuk jenis instans yang ditentukan. Jika akun Anda hanya mendukung EC2-VPC, armada Spot akan meluncurkan instans di Availability Zone dengan harga terendah yang memiliki subnet default. Jika akun Anda mendukung EC2-Classic, armada Spot meluncurkan instans dalam EC2-Classic di Availability Zone dengan harga terendah. Perhatikan bahwa harga yang Anda bayar tidak akan melebihi harga Spot yang ditentukan untuk permintaan tersebut.**  

```
$sg = New-Object Amazon.EC2.Model.GroupIdentifier
$sg.GroupId = "sg-12345678"
$lc = New-Object Amazon.EC2.Model.SpotFleetLaunchSpecification
$lc.ImageId = "ami-12345678"
$lc.InstanceType = "m3.medium"
$lc.SecurityGroups.Add($sg) 
Request-EC2SpotFleet -SpotFleetRequestConfig_SpotPrice 0.04 `
-SpotFleetRequestConfig_TargetCapacity 2 `
-SpotFleetRequestConfig_IamFleetRole arn:aws:iam::123456789012:role/my-spot-fleet-role `
-SpotFleetRequestConfig_LaunchSpecification $lc
```
+  Untuk detail API, lihat [RequestSpotFleet](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Request-EC2SpotInstance`
<a name="ec2_RequestSpotInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Request-EC2SpotInstance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini meminta instance Spot satu kali di subnet yang ditentukan. Perhatikan bahwa grup keamanan harus dibuat untuk VPC yang berisi subnet yang ditentukan, dan harus ditentukan oleh ID menggunakan antarmuka jaringan. Saat Anda menentukan antarmuka jaringan, Anda harus menyertakan ID subnet menggunakan antarmuka jaringan.**  

```
$n = New-Object Amazon.EC2.Model.InstanceNetworkInterfaceSpecification
$n.DeviceIndex = 0
$n.SubnetId = "subnet-12345678"
$n.Groups.Add("sg-12345678")
Request-EC2SpotInstance -InstanceCount 1 -SpotPrice 0.050 -Type one-time `
-IamInstanceProfile_Arn arn:aws:iam::123456789012:instance-profile/my-iam-role `
-LaunchSpecification_ImageId ami-12345678 `
-LaunchSpecification_InstanceType m3.medium `
-LaunchSpecification_NetworkInterface $n
```
**Output:**  

```
ActualBlockHourlyPrice   :
AvailabilityZoneGroup    :
BlockDurationMinutes     : 0
CreateTime               : 12/26/2015 7:44:10 AM
Fault                    :
InstanceId               :
LaunchedAvailabilityZone :
LaunchGroup              :
LaunchSpecification      : Amazon.EC2.Model.LaunchSpecification
ProductDescription       : Linux/UNIX
SpotInstanceRequestId    : sir-12345678
SpotPrice                : 0.050000
State                    : open
Status                   : Amazon.EC2.Model.SpotInstanceStatus
Tags                     : {}
Type                     : one-time
```
+  Untuk detail API, lihat [RequestSpotInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Reset-EC2ImageAttribute`
<a name="ec2_ResetImageAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Reset-EC2ImageAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini me-reset atribut 'launchPermission' ke nilai defaultnya. Secara default, AMIs bersifat pribadi.**  

```
Reset-EC2ImageAttribute -ImageId ami-12345678 -Attribute launchPermission
```
+  Untuk detail API, lihat [ResetImageAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Reset-EC2InstanceAttribute`
<a name="ec2_ResetInstanceAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Reset-EC2InstanceAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini me-reset atribut sriovNetSupport '' untuk instance tertentu.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute sriovNetSupport
```
**Contoh 2: Contoh ini me-reset atribut 'EBSOptimized' untuk instance tertentu.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute ebsOptimized
```
**Contoh 3: Contoh ini me-reset atribut sourceDestCheck '' untuk instance tertentu.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute sourceDestCheck
```
**Contoh 4: Contoh ini me-reset atribut disableApiTermination '' untuk instance tertentu.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute disableApiTermination
```
**Contoh 5: Contoh ini me-reset atribut 'instanceInitiatedShutdownBehavior' untuk instance tertentu.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute instanceInitiatedShutdownBehavior
```
+  Untuk detail API, lihat [ResetInstanceAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Reset-EC2NetworkInterfaceAttribute`
<a name="ec2_ResetNetworkInterfaceAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Reset-EC2NetworkInterfaceAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengatur ulang source/destination pemeriksaan antarmuka jaringan yang ditentukan.**  

```
Reset-EC2NetworkInterfaceAttribute -NetworkInterfaceId eni-1a2b3c4d -SourceDestCheck
```
+  Untuk detail API, lihat [ResetNetworkInterfaceAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Reset-EC2SnapshotAttribute`
<a name="ec2_ResetSnapshotAttribute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Reset-EC2SnapshotAttribute`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengatur ulang atribut tertentu dari snapshot yang ditentukan.**  

```
Reset-EC2SnapshotAttribute -SnapshotId snap-12345678 -Attribute CreateVolumePermission
```
+  Untuk detail API, lihat [ResetSnapshotAttribute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Restart-EC2Instance`
<a name="ec2_RebootInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Restart-EC2Instance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini me-reboot instance yang ditentukan.**  

```
Restart-EC2Instance -InstanceId i-12345678
```
+  Untuk detail API, lihat [RebootInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Revoke-EC2SecurityGroupEgress`
<a name="ec2_RevokeSecurityGroupEgress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Revoke-EC2SecurityGroupEgress`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus aturan untuk grup keamanan yang ditentukan untuk EC2-VPC. Ini mencabut akses ke rentang alamat IP yang ditentukan pada port TCP 80. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
$ip = @{ IpProtocol="tcp"; FromPort="80"; ToPort="80"; IpRanges="203.0.113.0/24" }
Revoke-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission $ip
```
**Contoh 2: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat objek. IpPermission **  

```
$ip = New-Object Amazon.EC2.Model.IpPermission
$ip.IpProtocol = "tcp"
$ip.FromPort = 80
$ip.ToPort = 80
$ip.IpRanges.Add("203.0.113.0/24")
Revoke-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission $ip
```
**Contoh 3: Contoh ini mencabut akses ke grup keamanan sumber yang ditentukan pada port TCP 80.**  

```
$ug = New-Object Amazon.EC2.Model.UserIdGroupPair
$ug.GroupId = "sg-1a2b3c4d"
$ug.UserId = "123456789012"
Revoke-EC2SecurityGroupEgress -GroupId sg-12345678 -IpPermission @( @{ IpProtocol="tcp"; FromPort="80"; ToPort="80"; UserIdGroupPairs=$ug } )
```
+  Untuk detail API, lihat [RevokeSecurityGroupEgress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Revoke-EC2SecurityGroupIngress`
<a name="ec2_RevokeSecurityGroupIngress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Revoke-EC2SecurityGroupIngress`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mencabut akses ke port TCP 22 dari rentang alamat yang ditentukan untuk grup keamanan yang ditentukan untuk EC2-VPC. Perhatikan bahwa Anda harus mengidentifikasi grup keamanan untuk EC2-VPC menggunakan ID grup keamanan bukan nama grup keamanan. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
$ip = @{ IpProtocol="tcp"; FromPort="22"; ToPort="22"; IpRanges="203.0.113.0/24" }
Revoke-EC2SecurityGroupIngress -GroupId sg-12345678 -IpPermission $ip
```
**Contoh 2: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat objek. IpPermission **  

```
$ip = New-Object Amazon.EC2.Model.IpPermission
$ip.IpProtocol = "tcp"
$ip.FromPort = 22
$ip.ToPort = 22
$ip.IpRanges.Add("203.0.113.0/24")

Revoke-EC2SecurityGroupIngress -GroupId sg-12345678 -IpPermission $ip
```
**Contoh 3: Contoh ini mencabut akses ke port TCP 22 dari rentang alamat yang ditentukan untuk grup keamanan yang ditentukan untuk EC2-Classic. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
$ip = @{ IpProtocol="tcp"; FromPort="22"; ToPort="22"; IpRanges="203.0.113.0/24" }

Revoke-EC2SecurityGroupIngress -GroupName "my-security-group" -IpPermission $ip
```
**Contoh 4: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat objek. IpPermission **  

```
$ip = New-Object Amazon.EC2.Model.IpPermission
$ip.IpProtocol = "tcp"
$ip.FromPort = 22
$ip.ToPort = 22
$ip.IpRanges.Add("203.0.113.0/24")

Revoke-EC2SecurityGroupIngress -GroupName "my-security-group" -IpPermission $ip
```
+  Untuk detail API, lihat [RevokeSecurityGroupIngress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Send-EC2InstanceStatus`
<a name="ec2_ReportInstanceStatus_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Send-EC2InstanceStatus`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini melaporkan umpan balik status untuk contoh yang ditentukan.**  

```
Send-EC2InstanceStatus -Instance i-12345678 -Status impaired -ReasonCode unresponsive
```
+  Untuk detail API, lihat [ReportInstanceStatus](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Set-EC2NetworkAclAssociation`
<a name="ec2_ReplaceNetworkAclAssociation_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Set-EC2NetworkAclAssociation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengaitkan ACL jaringan tertentu dengan subnet untuk asosiasi ACL jaringan tertentu.**  

```
Set-EC2NetworkAclAssociation -NetworkAclId acl-12345678 -AssociationId aclassoc-1a2b3c4d
```
**Output:**  

```
aclassoc-87654321
```
+  Untuk detail API, lihat [ReplaceNetworkAclAssociation](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Set-EC2NetworkAclEntry`
<a name="ec2_ReplaceNetworkAclEntry_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Set-EC2NetworkAclEntry`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menggantikan entri yang ditentukan untuk ACL jaringan tertentu. Aturan baru memungkinkan lalu lintas masuk dari alamat yang ditentukan ke subnet terkait.**  

```
Set-EC2NetworkAclEntry -NetworkAclId acl-12345678 -Egress $false -RuleNumber 100 -Protocol 17 -PortRange_From 53 -PortRange_To 53 -CidrBlock 203.0.113.12/24 -RuleAction allow
```
+  Untuk detail API, lihat [ReplaceNetworkAclEntry](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Set-EC2Route`
<a name="ec2_ReplaceRoute_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Set-EC2Route`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menggantikan rute yang ditentukan untuk tabel rute yang ditentukan. Rute baru mengirimkan lalu lintas yang ditentukan ke gateway pribadi virtual yang ditentukan.**  

```
Set-EC2Route -RouteTableId rtb-1a2b3c4d -DestinationCidrBlock 10.0.0.0/24 -GatewayId vgw-1a2b3c4d
```
+  Untuk detail API, lihat [ReplaceRoute](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Set-EC2RouteTableAssociation`
<a name="ec2_ReplaceRouteTableAssociation_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Set-EC2RouteTableAssociation`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini mengaitkan tabel rute yang ditentukan dengan subnet untuk asosiasi tabel rute yang ditentukan.**  

```
Set-EC2RouteTableAssociation -RouteTableId rtb-1a2b3c4d -AssociationId rtbassoc-12345678
```
**Output:**  

```
rtbassoc-87654321
```
+  Untuk detail API, lihat [ReplaceRouteTableAssociation](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Start-EC2Instance`
<a name="ec2_StartInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Start-EC2Instance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memulai instance yang ditentukan.**  

```
Start-EC2Instance -InstanceId i-12345678
```
**Output:**  

```
CurrentState                      InstanceId    PreviousState
------------                      ----------    -------------
Amazon.EC2.Model.InstanceState    i-12345678    Amazon.EC2.Model.InstanceState
```
**Contoh 2: Contoh ini memulai instance yang ditentukan.**  

```
@("i-12345678", "i-76543210") | Start-EC2Instance
```
**Contoh 3: Contoh ini memulai kumpulan instance yang saat ini dihentikan. Objek Instance yang dikembalikan oleh Get-EC2Instance disalurkan keStart-EC2Instance. Sintaks yang digunakan oleh contoh ini membutuhkan PowerShell versi 3 atau lebih tinggi.**  

```
(Get-EC2Instance -Filter @{ Name="instance-state-name"; Values="stopped"}).Instances | Start-EC2Instance
```
**Contoh 4: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat filter untuk parameter Filter.**  

```
$filter = New-Object Amazon.EC2.Model.Filter
$filter.Name = "instance-state-name"
$filter.Values = "stopped"

(Get-EC2Instance -Filter $filter).Instances | Start-EC2Instance
```
+  Untuk detail API, lihat [StartInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Start-EC2InstanceMonitoring`
<a name="ec2_MonitorInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Start-EC2InstanceMonitoring`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memungkinkan pemantauan terperinci untuk contoh yang ditentukan.**  

```
Start-EC2InstanceMonitoring -InstanceId i-12345678
```
**Output:**  

```
InstanceId    Monitoring
----------    ----------
i-12345678    Amazon.EC2.Model.Monitoring
```
+  Untuk detail API, lihat [MonitorInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Stop-EC2ImportTask`
<a name="ec2_CancelImportTask_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Stop-EC2ImportTask`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membatalkan tugas impor yang ditentukan (baik snapshot atau impor gambar). Jika diperlukan, alasan dapat menyediakan menggunakan `-CancelReason` parameter.**  

```
Stop-EC2ImportTask -ImportTaskId import-ami-abcdefgh
```
+  Untuk detail API, lihat [CancelImportTask](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Stop-EC2Instance`
<a name="ec2_StopInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Stop-EC2Instance`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghentikan instance yang ditentukan.**  

```
Stop-EC2Instance -InstanceId i-12345678
```
**Output:**  

```
CurrentState                      InstanceId    PreviousState
------------                      ----------    -------------
Amazon.EC2.Model.InstanceState    i-12345678    Amazon.EC2.Model.InstanceState
```
+  Untuk detail API, lihat [StopInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Stop-EC2InstanceMonitoring`
<a name="ec2_UnmonitorInstances_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Stop-EC2InstanceMonitoring`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menonaktifkan pemantauan terperinci untuk contoh yang ditentukan.**  

```
Stop-EC2InstanceMonitoring -InstanceId i-12345678
```
**Output:**  

```
InstanceId    Monitoring
----------    ----------
i-12345678    Amazon.EC2.Model.Monitoring
```
+  Untuk detail API, lihat [UnmonitorInstances](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Stop-EC2SpotFleetRequest`
<a name="ec2_CancelSpotFleetRequests_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Stop-EC2SpotFleetRequest`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membatalkan permintaan armada Spot yang ditentukan dan mengakhiri instance Spot terkait.**  

```
Stop-EC2SpotFleetRequest -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -TerminateInstance $true
```
**Contoh 2: Contoh ini membatalkan permintaan armada Spot yang ditentukan tanpa menghentikan instans Spot terkait.**  

```
Stop-EC2SpotFleetRequest -SpotFleetRequestId sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE -TerminateInstance $false
```
+  Untuk detail API, lihat [CancelSpotFleetRequests](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Stop-EC2SpotInstanceRequest`
<a name="ec2_CancelSpotInstanceRequests_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Stop-EC2SpotInstanceRequest`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membatalkan permintaan instance Spot yang ditentukan.**  

```
Stop-EC2SpotInstanceRequest -SpotInstanceRequestId sir-12345678
```
**Output:**  

```
SpotInstanceRequestId    State
---------------------    -----
sir-12345678             cancelled
```
+  Untuk detail API, lihat [CancelSpotInstanceRequests](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Unregister-EC2Address`
<a name="ec2_DisassociateAddress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Unregister-EC2Address`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini memisahkan alamat IP Elastis yang ditentukan dari instance yang ditentukan dalam VPC.**  

```
Unregister-EC2Address -AssociationId eipassoc-12345678
```
**Contoh 2: Contoh ini memisahkan alamat IP Elastis yang ditentukan dari instance yang ditentukan di EC2-Classic.**  

```
Unregister-EC2Address -PublicIp 203.0.113.17
```
+  Untuk detail API, lihat [DisassociateAddress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Unregister-EC2Image`
<a name="ec2_DeregisterImage_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Unregister-EC2Image`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membatalkan pendaftaran AMI yang ditentukan.**  

```
Unregister-EC2Image -ImageId ami-12345678
```
+  Untuk detail API, lihat [DeregisterImage](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Unregister-EC2PrivateIpAddress`
<a name="ec2_UnassignPrivateIpAddresses_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Unregister-EC2PrivateIpAddress`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini membatalkan penetapan alamat IP pribadi yang ditentukan dari antarmuka jaringan yang ditentukan.**  

```
Unregister-EC2PrivateIpAddress -NetworkInterfaceId eni-1a2b3c4d -PrivateIpAddress 10.0.0.82
```
+  Untuk detail API, lihat [UnassignPrivateIpAddresses](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Unregister-EC2RouteTable`
<a name="ec2_DisassociateRouteTable_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Unregister-EC2RouteTable`.

**Alat untuk PowerShell V4**  
**Contoh 1: Contoh ini menghapus asosiasi tertentu antara tabel rute dan subnet.**  

```
Unregister-EC2RouteTable -AssociationId rtbassoc-1a2b3c4d
```
+  Untuk detail API, lihat [DisassociateRouteTable](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 

### `Update-EC2SecurityGroupRuleIngressDescription`
<a name="ec2_UpdateSecurityGroupRuleDescriptionsIngress_powershell_4_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Update-EC2SecurityGroupRuleIngressDescription`.

**Alat untuk PowerShell V4**  
**Contoh 1: Memperbarui deskripsi aturan grup keamanan ingress (inbound) yang ada.**  

```
$existingInboundRule = Get-EC2SecurityGroupRule -SecurityGroupRuleId "sgr-1234567890"
$ruleWithUpdatedDescription = [Amazon.EC2.Model.SecurityGroupRuleDescription]@{
  "SecurityGroupRuleId" = $existingInboundRule.SecurityGroupRuleId
  "Description" = "Updated rule description"
}

Update-EC2SecurityGroupRuleIngressDescription -GroupId $existingInboundRule.GroupId -SecurityGroupRuleDescription $ruleWithUpdatedDescription
```
**Contoh 2: Menghapus deskripsi aturan grup keamanan ingress (inbound) yang ada (dengan menghilangkan parameter dalam permintaan).**  

```
$existingInboundRule = Get-EC2SecurityGroupRule -SecurityGroupRuleId "sgr-1234567890"
$ruleWithoutDescription = [Amazon.EC2.Model.SecurityGroupRuleDescription]@{
  "SecurityGroupRuleId" = $existingInboundRule.SecurityGroupRuleId
}

Update-EC2SecurityGroupRuleIngressDescription -GroupId $existingInboundRule.GroupId -SecurityGroupRuleDescription $ruleWithoutDescription
```
+  Untuk detail API, lihat [UpdateSecurityGroupRuleDescriptionsIngress](https://docs.aws.amazon.com/powershell/v4/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V4)*. 