

Versi 5 (V5) dari Alat AWS untuk PowerShell telah dirilis\$1

Untuk informasi tentang melanggar perubahan dan memigrasi aplikasi Anda, lihat [topik migrasi](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html).

 [https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html)

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

# CodeDeploy contoh menggunakan Alat untuk PowerShell V5
<a name="powershell_codedeploy_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan Alat AWS untuk PowerShell V5 dengan CodeDeploy.

*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-CDOnPremiseInstanceTag`
<a name="codedeploy_AddTagsToOnPremisesInstances_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menambahkan tag instans lokal dengan kunci dan nilai yang ditentukan untuk instans lokal yang ditentukan.**  

```
Add-CDOnPremiseInstanceTag -InstanceName AssetTag12010298EX -Tag @{"Key" = "Name"; "Value" = "CodeDeployDemo-OnPrem"}
```
+  Untuk detail API, lihat [AddTagsToOnPremisesInstances](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDApplication`
<a name="codedeploy_GetApplication_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang aplikasi yang ditentukan.**  

```
Get-CDApplication -ApplicationName CodeDeployDemoApplication
```
**Output:**  

```
ApplicationId                           ApplicationName              CreateTime              LinkedToGitHub
-------------                           ---------------              ----------              --------------
e07fb938-091e-4f2f-8963-4d3e8EXAMPLE    CodeDeployDemoApplication    7/20/2015 9:49:48 PM    False
```
+  Untuk detail API, lihat [GetApplication](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDApplicationBatch`
<a name="codedeploy_BatchGetApplications_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang aplikasi yang ditentukan.**  

```
Get-CDApplicationBatch -ApplicationName CodeDeployDemoApplication, CodePipelineDemoApplication
```
**Output:**  

```
ApplicationId                           ApplicationName              CreateTime              LinkedToGitHub
-------------                           ---------------              ----------              --------------
e07fb938-091e-4f2f-8963-4d3e8EXAMPLE    CodeDeployDemoApplication    7/20/2015 9:49:48 PM    False
1ecfd602-62f1-4038-8f0d-06688EXAMPLE    CodePipelineDemoApplication  8/13/2015 5:53:26 PM    False
```
+  Untuk detail API, lihat [BatchGetApplications](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDApplicationList`
<a name="codedeploy_ListApplications_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan daftar aplikasi yang tersedia.**  

```
Get-CDApplicationList
```
**Output:**  

```
CodeDeployDemoApplication
CodePipelineDemoApplication
```
+  Untuk detail API, lihat [ListApplications](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDApplicationRevision`
<a name="codedeploy_GetApplicationRevision_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang revisi aplikasi yang ditentukan.**  

```
$revision = Get-CDApplicationRevision -ApplicationName CodeDeployDemoApplication -S3Location_Bucket amzn-s3-demo-bucket -Revision_RevisionType S3 -S3Location_Key 5xd27EX.zip -S3Location_BundleType zip -S3Location_ETag 4565c1ac97187f190c1a90265EXAMPLE
Write-Output ("Description = " + $revision.RevisionInfo.Description + ", RegisterTime = " + $revision.RevisionInfo.RegisterTime)
```
**Output:**  

```
Description = Application revision registered by Deployment ID: d-CX9CHN3EX, RegisterTime = 07/20/2015 23:46:42
```
+  Untuk detail API, lihat [GetApplicationRevision](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDApplicationRevisionList`
<a name="codedeploy_ListApplicationRevisions_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang revisi yang tersedia untuk aplikasi yang ditentukan.**  

```
ForEach ($revision in (Get-CDApplicationRevisionList -ApplicationName CodeDeployDemoApplication -Deployed Ignore)) {
>>   If ($revision.RevisionType -Eq "S3") {
>>     Write-Output ("Type = S3, Bucket = " + $revision.S3Location.Bucket + ", BundleType = " + $revision.S3Location.BundleType + ", ETag = " + $revision.S3Location.ETag + ", Key = " + $revision.S3Location.Key)
>>   }
>>   If ($revision.RevisionType -Eq "GitHub") {
>>     Write-Output ("Type = GitHub, CommitId = " + $revision.GitHubLocation.CommitId + ", Repository = " + $revision.GitHubLocation.Repository)
>>   }
>> }
>>
```
**Output:**  

```
Type = S3, Bucket = amzn-s3-demo-bucket, BundleType = zip, ETag = 4565c1ac97187f190c1a90265EXAMPLE, Key = 5xd27EX.zip
Type = GitHub, CommitId = f48933c3...76405362, Repository = MyGitHubUser/CodeDeployDemoRepo
```
+  Untuk detail API, lihat [ListApplicationRevisions](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeployment`
<a name="codedeploy_GetDeployment_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi ringkasan tentang penerapan yang ditentukan.**  

```
Get-CDDeployment -DeploymentId d-QZMRGSTEX
```
**Output:**  

```
ApplicationName               : CodeDeployDemoApplication
CompleteTime                  : 7/23/2015 11:26:04 PM
CreateTime                    : 7/23/2015 11:24:43 PM
Creator                       : user
DeploymentConfigName          : CodeDeployDefault.OneAtATime
DeploymentGroupName           : CodeDeployDemoFleet
DeploymentId                  : d-QZMRGSTEX
DeploymentOverview            : Amazon.CodeDeploy.Model.DeploymentOverview
Description                   :
ErrorInformation              :
IgnoreApplicationStopFailures : False
Revision                      : Amazon.CodeDeploy.Model.RevisionLocation
StartTime                     : 1/1/0001 12:00:00 AM
Status                        : Succeeded
```
**Contoh 2: Contoh ini mendapatkan informasi tentang status instance yang berpartisipasi dalam penerapan yang ditentukan.**  

```
(Get-CDDeployment -DeploymentId d-QZMRGSTEX).DeploymentOverview
```
**Output:**  

```
Failed     : 0
InProgress : 0
Pending    : 0
Skipped    : 0
Succeeded  : 3
```
**Contoh 3: Contoh ini mendapatkan informasi tentang revisi aplikasi untuk penerapan yang ditentukan.**  

```
(Get-CDDeployment -DeploymentId d-QZMRGSTEX).Revision.S3Location
```
**Output:**  

```
Bucket     : amzn-s3-demo-bucket
BundleType : zip
ETag       : cfbb81b304ee5e27efc21adaed3EXAMPLE
Key        : clzfqEX
Version    :
```
+  Untuk detail API, lihat [GetDeployment](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeploymentBatch`
<a name="codedeploy_BatchGetDeployments_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang penerapan yang ditentukan.**  

```
Get-CDDeploymentBatch -DeploymentId d-QZMRGSTEX, d-RR0T5KTEX
```
**Output:**  

```
ApplicationName               : CodeDeployDemoApplication
CompleteTime                  : 7/23/2015 11:26:04 PM
CreateTime                    : 7/23/2015 11:24:43 PM
Creator                       : user
DeploymentConfigName          : CodeDeployDefault.OneAtATime
DeploymentGroupName           : CodeDeployDemoFleet
DeploymentId                  : d-QZMRGSTEX
DeploymentOverview            : Amazon.CodeDeploy.Model.DeploymentOverview
Description                   :
ErrorInformation              :
IgnoreApplicationStopFailures : False
Revision                      : Amazon.CodeDeploy.Model.RevisionLocation
StartTime                     : 1/1/0001 12:00:00 AM
Status                        : Succeeded

ApplicationName               : CodePipelineDemoApplication
CompleteTime                  : 7/23/2015 6:07:30 PM
CreateTime                    : 7/23/2015 6:06:29 PM
Creator                       : user
DeploymentConfigName          : CodeDeployDefault.OneAtATime
DeploymentGroupName           : CodePipelineDemoFleet
DeploymentId                  : d-RR0T5KTEX
DeploymentOverview            : Amazon.CodeDeploy.Model.DeploymentOverview
Description                   :
ErrorInformation              :
IgnoreApplicationStopFailures : False
Revision                      : Amazon.CodeDeploy.Model.RevisionLocation
StartTime                     : 1/1/0001 12:00:00 AM
Status                        : Succeeded
```
+  Untuk detail API, lihat [BatchGetDeployments](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeploymentConfig`
<a name="codedeploy_GetDeploymentConfig_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi ringkasan tentang konfigurasi penerapan yang ditentukan.**  

```
Get-CDDeploymentConfig -DeploymentConfigName ThreeQuartersHealthy
```
**Output:**  

```
CreateTime              DeploymentConfigId                      DeploymentConfigName    MinimumHealthyHosts
----------              ------------------                      --------------------    -------------------
10/3/2014 4:32:30 PM    518a3950-d034-46a1-9d2c-3c949EXAMPLE    ThreeQuartersHealthy    Amazon.CodeDeploy.Model.MinimumHealthyHosts
```
**Contoh 2: Contoh ini mendapatkan informasi tentang definisi konfigurasi penerapan yang ditentukan.**  

```
Write-Output ((Get-CDDeploymentConfig -DeploymentConfigName ThreeQuartersHealthy).MinimumHealthyHosts)
```
**Output:**  

```
Type             Value
----             -----
FLEET_PERCENT    75
```
+  Untuk detail API, lihat [GetDeploymentConfig](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeploymentConfigList`
<a name="codedeploy_ListDeploymentConfigs_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan daftar konfigurasi penerapan yang tersedia.**  

```
Get-CDDeploymentConfigList
```
**Output:**  

```
ThreeQuartersHealthy
CodeDeployDefault.OneAtATime
CodeDeployDefault.AllAtOnce
CodeDeployDefault.HalfAtATime
```
+  Untuk detail API, lihat [ListDeploymentConfigs](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeploymentGroup`
<a name="codedeploy_GetDeploymentGroup_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang grup penyebaran yang ditentukan.**  

```
Get-CDDeploymentGroup -ApplicationName CodeDeployDemoApplication -DeploymentGroupName CodeDeployDemoFleet
```
**Output:**  

```
ApplicationName              : CodeDeployDemoApplication
AutoScalingGroups            : {}
DeploymentConfigName         : CodeDeployDefault.OneAtATime
DeploymentGroupId            : 7d7c098a-b444-4b27-96ef-22791EXAMPLE
DeploymentGroupName          : CodeDeployDemoFleet
Ec2TagFilters                : {Name}
OnPremisesInstanceTagFilters : {}
ServiceRoleArn               : arn:aws:iam::80398EXAMPLE:role/CodeDeploySampleStack-4ph6EX-CodeDeployTrustRole-O9MWP7XTL8EX
TargetRevision               : Amazon.CodeDeploy.Model.RevisionLocation
```
+  Untuk detail API, lihat [GetDeploymentGroup](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeploymentGroupList`
<a name="codedeploy_ListDeploymentGroups_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan daftar grup penyebaran untuk aplikasi yang ditentukan.**  

```
Get-CDDeploymentGroupList -ApplicationName CodeDeployDemoApplication
```
**Output:**  

```
ApplicationName              DeploymentGroups                                    NextToken
---------------              ----------------                                    ---------
CodeDeployDemoApplication    {CodeDeployDemoFleet, CodeDeployProductionFleet}
```
+  Untuk detail API, lihat [ListDeploymentGroups](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeploymentInstance`
<a name="codedeploy_GetDeploymentInstance_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang instance yang ditentukan untuk penerapan yang ditentukan.**  

```
Get-CDDeploymentInstance -DeploymentId d-QZMRGSTEX -InstanceId i-254e22EX
```
**Output:**  

```
DeploymentId    : d-QZMRGSTEX
InstanceId      : arn:aws:ec2:us-east-1:80398EXAMPLE:instance/i-254e22EX
LastUpdatedAt   : 7/23/2015 11:25:24 PM
LifecycleEvents : {ApplicationStop, DownloadBundle, BeforeInstall, Install...}
Status          : Succeeded
```
+  Untuk detail API, lihat [GetDeploymentInstance](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeploymentInstanceList`
<a name="codedeploy_ListDeploymentInstances_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan daftar instance IDs untuk penerapan yang ditentukan.**  

```
Get-CDDeploymentInstanceList -DeploymentId d-QZMRGSTEX
```
**Output:**  

```
i-254e22EX
i-274e22EX
i-3b4e22EX
```
+  Untuk detail API, lihat [ListDeploymentInstances](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDDeploymentList`
<a name="codedeploy_ListDeployments_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan daftar penerapan IDs untuk grup aplikasi dan penyebaran yang ditentukan.**  

```
Get-CDDeploymentList -ApplicationName CodeDeployDemoApplication -DeploymentGroupName CodeDeployDemoFleet
```
**Output:**  

```
d-QZMRGSTEX
d-RR0T5KTEX
```
+  Untuk detail API, lihat [ListDeployments](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDOnPremiseInstance`
<a name="codedeploy_GetOnPremisesInstance_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang instans lokal yang ditentukan.**  

```
Get-CDOnPremiseInstance -InstanceName AssetTag12010298EX
```
**Output:**  

```
DeregisterTime : 1/1/0001 12:00:00 AM
IamUserArn     : arn:aws:iam::80398EXAMPLE:user/CodeDeployDemoUser
InstanceArn    : arn:aws:codedeploy:us-east-1:80398EXAMPLE:instance/AssetTag12010298EX_rDH556dxEX
InstanceName   : AssetTag12010298EX
RegisterTime   : 4/3/2015 6:36:24 PM
Tags           : {Name}
```
+  Untuk detail API, lihat [GetOnPremisesInstance](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDOnPremiseInstanceBatch`
<a name="codedeploy_BatchGetOnPremisesInstances_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan informasi tentang instance lokal yang ditentukan.**  

```
Get-CDOnPremiseInstanceBatch -InstanceName AssetTag12010298EX, AssetTag12010298EX-2
```
**Output:**  

```
DeregisterTime : 1/1/0001 12:00:00 AM
IamUserArn     : arn:aws:iam::80398EXAMPLE:user/CodeDeployFRWUser
InstanceArn    : arn:aws:codedeploy:us-east-1:80398EXAMPLE:instance/AssetTag12010298EX-2_XmeSz18rEX
InstanceName   : AssetTag12010298EX-2
RegisterTime   : 4/3/2015 6:38:52 PM
Tags           : {Name}

DeregisterTime : 1/1/0001 12:00:00 AM
IamUserArn     : arn:aws:iam::80398EXAMPLE:user/CodeDeployDemoUser
InstanceArn    : arn:aws:codedeploy:us-east-1:80398EXAMPLE:instance/AssetTag12010298EX_rDH556dxEX
InstanceName   : AssetTag12010298EX
RegisterTime   : 4/3/2015 6:36:24 PM
Tags           : {Name}
```
+  Untuk detail API, lihat [BatchGetOnPremisesInstances](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Get-CDOnPremiseInstanceList`
<a name="codedeploy_ListOnPremisesInstances_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendapatkan daftar nama instans lokal yang tersedia.**  

```
Get-CDOnPremiseInstanceList
```
**Output:**  

```
AssetTag12010298EX
AssetTag12010298EX-2
```
+  Untuk detail API, lihat [ListOnPremisesInstances](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `New-CDApplication`
<a name="codedeploy_CreateApplication_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini membuat aplikasi baru dengan nama yang ditentukan.**  

```
New-CDApplication -ApplicationName MyNewApplication
```
**Output:**  

```
f19e4b61-2231-4328-b0fd-e57f5EXAMPLE
```
+  Untuk detail API, lihat [CreateApplication](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `New-CDDeployment`
<a name="codedeploy_CreateDeployment_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini membuat penyebaran baru untuk grup aplikasi dan penyebaran yang ditentukan dengan konfigurasi penerapan dan revisi aplikasi yang ditentukan.**  

```
New-CDDeployment -ApplicationName MyNewApplication -S3Location_Bucket amzn-s3-demo-bucket -S3Location_BundleType zip -DeploymentConfigName CodeDeployDefault.OneAtATime -DeploymentGroupName MyNewDeploymentGroup -IgnoreApplicationStopFailures $True -S3Location_Key aws-codedeploy_linux-master.zip -RevisionType S3
```
**Output:**  

```
d-ZHROG7UEX
```
**Contoh 2: Contoh ini menunjukkan cara menentukan grup tag EC2 instance yang harus diidentifikasi oleh sebuah instance agar dapat disertakan dalam lingkungan pengganti untuk blue/green penerapan.**  

```
New-CDDeployment -ApplicationName MyNewApplication -S3Location_Bucket amzn-s3-demo-bucket -S3Location_BundleType zip -DeploymentConfigName CodeDeployDefault.OneAtATime -DeploymentGroupName MyNewDeploymentGroup -IgnoreApplicationStopFailures $True -S3Location_Key aws-codedeploy_linux-master.zip -RevisionType S3 -Ec2TagSetList @(@{Key="key1";Type="KEY_ONLY"},@{Key="Key2";Type="KEY_AND_VALUE";Value="Value2"}),@(@{Key="Key3";Type="VALUE_ONLY";Value="Value3"})
```
**Output:**  

```
d-ZHROG7UEX
```
+  Untuk detail API, lihat [CreateDeployment](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `New-CDDeploymentConfig`
<a name="codedeploy_CreateDeploymentConfig_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini membuat konfigurasi penerapan baru dengan nama dan perilaku yang ditentukan.**  

```
New-CDDeploymentConfig -DeploymentConfigName AtLeastTwoHealthyHosts -MinimumHealthyHosts_Type HOST_COUNT -MinimumHealthyHosts_Value 2
```
**Output:**  

```
0f3e8187-44ef-42da-aeed-b6823EXAMPLE
```
+  Untuk detail API, lihat [CreateDeploymentConfig](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `New-CDDeploymentGroup`
<a name="codedeploy_CreateDeploymentGroup_powershell_topic"></a>

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

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini membuat grup penyebaran dengan nama yang ditentukan, grup Auto Scaling, konfigurasi penerapan, tag, dan peran layanan, untuk aplikasi yang ditentukan.**  

```
New-CDDeploymentGroup -ApplicationName MyNewApplication -AutoScalingGroup CodeDeployDemo-ASG -DeploymentConfigName CodeDeployDefault.OneAtATime -DeploymentGroupName MyNewDeploymentGroup -Ec2TagFilter @{Key="Name"; Type="KEY_AND_VALUE"; Value="CodeDeployDemo"} -ServiceRoleArn arn:aws:iam::80398EXAMPLE:role/CodeDeployDemo
```
**Output:**  

```
16bbf199-95fd-40fc-a909-0bbcfEXAMPLE
```
**Contoh 2: Contoh ini menunjukkan cara menentukan grup tag EC2 instance yang harus diidentifikasi oleh sebuah instance agar dapat disertakan dalam lingkungan pengganti untuk blue/green penerapan.**  

```
New-CDDeploymentGroup -ApplicationName MyNewApplication -AutoScalingGroup CodeDeployDemo-ASG -DeploymentConfigName CodeDeployDefault.OneAtATime -DeploymentGroupName MyNewDeploymentGroup -Ec2TagFilter @{Key="Name"; Type="KEY_AND_VALUE"; Value="CodeDeployDemo"} -ServiceRoleArn arn:aws:iam::80398EXAMPLE:role/CodeDeployDemo -Ec2TagSetList @(@{Key="key1";Type="KEY_ONLY"},@{Key="Key2";Type="KEY_AND_VALUE";Value="Value2"}),@(@{Key="Key3";Type="VALUE_ONLY";Value="Value3"})
```
**Output:**  

```
16bbf199-95fd-40fc-a909-0bbcfEXAMPLE
```
+  Untuk detail API, lihat [CreateDeploymentGroup](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Register-CDApplicationRevision`
<a name="codedeploy_RegisterApplicationRevision_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-CDApplicationRevision`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendaftarkan revisi aplikasi dengan lokasi Amazon S3 yang ditentukan, untuk aplikasi yang ditentukan.**  

```
Register-CDApplicationRevision -ApplicationName MyNewApplication -S3Location_Bucket amzn-s3-demo-bucket -S3Location_BundleType zip -S3Location_Key aws-codedeploy_linux-master.zip -Revision_RevisionType S3
```
+  Untuk detail API, lihat [RegisterApplicationRevision](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Register-CDOnPremiseInstance`
<a name="codedeploy_RegisterOnPremisesInstance_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Register-CDOnPremiseInstance`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mendaftarkan instance lokal dengan nama yang ditentukan dan pengguna IAM.**  

```
Register-CDOnPremiseInstance -IamUserArn arn:aws:iam::80398EXAMPLE:user/CodeDeployDemoUser -InstanceName AssetTag12010298EX
```
+  Untuk detail API, lihat [RegisterOnPremisesInstance](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Remove-CDApplication`
<a name="codedeploy_DeleteApplication_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-CDApplication`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menghapus aplikasi dengan nama yang ditentukan. Perintah akan meminta konfirmasi sebelum melanjutkan. Tambahkan parameter -Force untuk menghapus aplikasi tanpa prompt.**  

```
Remove-CDApplication -ApplicationName MyNewApplication
```
+  Untuk detail API, lihat [DeleteApplication](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Remove-CDDeploymentConfig`
<a name="codedeploy_DeleteDeploymentConfig_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-CDDeploymentConfig`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menghapus konfigurasi penerapan dengan nama yang ditentukan. Perintah akan meminta konfirmasi sebelum melanjutkan. Tambahkan parameter -Force untuk menghapus konfigurasi penerapan tanpa prompt.**  

```
Remove-CDDeploymentConfig -DeploymentConfigName AtLeastTwoHealthyHosts
```
+  Untuk detail API, lihat [DeleteDeploymentConfig](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Remove-CDDeploymentGroup`
<a name="codedeploy_DeleteDeploymentGroup_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-CDDeploymentGroup`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menghapus grup penyebaran dengan nama yang ditentukan untuk aplikasi yang ditentukan. Perintah akan meminta konfirmasi sebelum melanjutkan. Tambahkan parameter -Force untuk menghapus grup penyebaran tanpa prompt.**  

```
Remove-CDDeploymentGroup -ApplicationName MyNewApplication -DeploymentGroupName MyNewDeploymentGroup
```
+  Untuk detail API, lihat [DeleteDeploymentGroup](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Remove-CDOnPremiseInstanceTag`
<a name="codedeploy_RemoveTagsFromOnPremisesInstances_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Remove-CDOnPremiseInstanceTag`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini menghapus tag yang ditentukan untuk instance lokal dengan nama yang ditentukan. Perintah akan meminta konfirmasi sebelum melanjutkan. Tambahkan parameter -Force untuk menghapus tag tanpa prompt.**  

```
Remove-CDOnPremiseInstanceTag -InstanceName AssetTag12010298EX -Tag @{"Key" = "Name"; "Value" = "CodeDeployDemo-OnPrem"}
```
+  Untuk detail API, lihat [RemoveTagsFromOnPremisesInstances](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Stop-CDDeployment`
<a name="codedeploy_StopDeployment_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Stop-CDDeployment`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mencoba menghentikan penerapan dengan ID penerapan yang ditentukan.**  

```
Stop-CDDeployment -DeploymentId d-LJQNREYEX
```
**Output:**  

```
Status     StatusMessage
------     -------------
Pending    Stopping Pending. Stopping to schedule commands in the deployment instances
```
+  Untuk detail API, lihat [StopDeployment](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Unregister-CDOnPremiseInstance`
<a name="codedeploy_DeregisterOnPremisesInstance_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Unregister-CDOnPremiseInstance`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini membatalkan pendaftaran instans lokal dengan nama yang ditentukan.**  

```
Unregister-CDOnPremiseInstance -InstanceName AssetTag12010298EX
```
+  Untuk detail API, lihat [DeregisterOnPremisesInstance](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Update-CDApplication`
<a name="codedeploy_UpdateApplication_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Update-CDApplication`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mengubah nama aplikasi yang ditentukan.**  

```
Update-CDApplication -ApplicationName MyNewApplication -NewApplicationName MyNewApplication-2
```
+  Untuk detail API, lihat [UpdateApplication](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 

### `Update-CDDeploymentGroup`
<a name="codedeploy_UpdateDeploymentGroup_powershell_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`Update-CDDeploymentGroup`.

**Alat untuk PowerShell V5**  
**Contoh 1: Contoh ini mengubah nama grup penyebaran yang ditentukan untuk aplikasi yang ditentukan.**  

```
Update-CDDeploymentGroup -ApplicationName MyNewApplication -CurrentDeploymentGroupName MyNewDeploymentGroup -NewDeploymentGroupName MyNewDeploymentGroup-2
```
**Contoh 2: Contoh ini menunjukkan cara menentukan grup tag EC2 instance yang harus diidentifikasi oleh sebuah instance agar dapat disertakan dalam lingkungan pengganti untuk blue/green penerapan.**  

```
Update-CDDeploymentGroup -ApplicationName MyNewApplication -CurrentDeploymentGroupName MyNewDeploymentGroup -NewDeploymentGroupName MyNewDeploymentGroup-2 -Ec2TagSetList @(@{Key="key1";Type="KEY_ONLY"},@{Key="Key2";Type="KEY_AND_VALUE";Value="Value2"}),@(@{Key="Key3";Type="VALUE_ONLY";Value="Value3"})
```
+  Untuk detail API, lihat [UpdateDeploymentGroup](https://docs.aws.amazon.com/powershell/v5/reference)di *Referensi Alat AWS untuk PowerShell Cmdlet (V5)*. 