Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
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
Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan Alat AWS untuk PowerShell with CodeDeploy.
Tindakan adalah 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.
Topik
Tindakan
Contoh kode berikut menunjukkan cara menggunakanAdd-CDOnPremiseInstanceTag
.
- Alat untuk PowerShell
-
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 AddTagsToOnPremisesInstancesdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDApplication
.
- Alat untuk PowerShell
-
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 GetApplicationdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDApplicationBatch
.
- Alat untuk PowerShell
-
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 BatchGetApplicationsdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDApplicationList
.
- Alat untuk PowerShell
-
Contoh 1: Contoh ini mendapatkan daftar aplikasi yang tersedia.
Get-CDApplicationList
Output:
CodeDeployDemoApplication CodePipelineDemoApplication
-
Untuk detail API, lihat ListApplicationsdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDApplicationRevision
.
- Alat untuk PowerShell
-
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 GetApplicationRevisiondi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDApplicationRevisionList
.
- Alat untuk PowerShell
-
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 = MyBucket, BundleType = zip, ETag = 4565c1ac97187f190c1a90265EXAMPLE, Key = 5xd27EX.zip Type = GitHub, CommitId = f48933c3...76405362, Repository = MyGitHubUser/CodeDeployDemoRepo
-
Untuk detail API, lihat ListApplicationRevisionsdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeployment
.
- Alat untuk PowerShell
-
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 : MyBucket BundleType : zip ETag : cfbb81b304ee5e27efc21adaed3EXAMPLE Key : clzfqEX Version :
-
Untuk detail API, lihat GetDeploymentdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeploymentBatch
.
- Alat untuk PowerShell
-
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 BatchGetDeploymentsdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeploymentConfig
.
- Alat untuk PowerShell
-
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 GetDeploymentConfigdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeploymentConfigList
.
- Alat untuk PowerShell
-
Contoh 1: Contoh ini mendapatkan daftar konfigurasi penerapan yang tersedia.
Get-CDDeploymentConfigList
Output:
ThreeQuartersHealthy CodeDeployDefault.OneAtATime CodeDeployDefault.AllAtOnce CodeDeployDefault.HalfAtATime
-
Untuk detail API, lihat ListDeploymentConfigsdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeploymentGroup
.
- Alat untuk PowerShell
-
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 GetDeploymentGroupdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeploymentGroupList
.
- Alat untuk PowerShell
-
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 ListDeploymentGroupsdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeploymentInstance
.
- Alat untuk PowerShell
-
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 GetDeploymentInstancedi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeploymentInstanceList
.
- Alat untuk PowerShell
-
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 ListDeploymentInstancesdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDDeploymentList
.
- Alat untuk PowerShell
-
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 ListDeploymentsdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDOnPremiseInstance
.
- Alat untuk PowerShell
-
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 GetOnPremisesInstancedi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDOnPremiseInstanceBatch
.
- Alat untuk PowerShell
-
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 BatchGetOnPremisesInstancesdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanGet-CDOnPremiseInstanceList
.
- Alat untuk PowerShell
-
Contoh 1: Contoh ini mendapatkan daftar nama instans lokal yang tersedia.
Get-CDOnPremiseInstanceList
Output:
AssetTag12010298EX AssetTag12010298EX-2
-
Untuk detail API, lihat ListOnPremisesInstancesdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanNew-CDApplication
.
- Alat untuk PowerShell
-
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 CreateApplicationdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanNew-CDDeployment
.
- Alat untuk PowerShell
-
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 penerapan biru/hijau.
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 CreateDeploymentdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanNew-CDDeploymentConfig
.
- Alat untuk PowerShell
-
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 CreateDeploymentConfigdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanNew-CDDeploymentGroup
.
- Alat untuk PowerShell
-
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 penerapan biru/hijau.
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 CreateDeploymentGroupdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanRegister-CDApplicationRevision
.
- Alat untuk PowerShell
-
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 RegisterApplicationRevisiondi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanRegister-CDOnPremiseInstance
.
- Alat untuk PowerShell
-
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 RegisterOnPremisesInstancedi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanRemove-CDApplication
.
- Alat untuk PowerShell
-
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 DeleteApplicationdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanRemove-CDDeploymentConfig
.
- Alat untuk PowerShell
-
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 DeleteDeploymentConfigdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanRemove-CDDeploymentGroup
.
- Alat untuk PowerShell
-
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 DeleteDeploymentGroupdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanRemove-CDOnPremiseInstanceTag
.
- Alat untuk PowerShell
-
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 RemoveTagsFromOnPremisesInstancesdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanStop-CDDeployment
.
- Alat untuk PowerShell
-
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 StopDeploymentdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanUnregister-CDOnPremiseInstance
.
- Alat untuk PowerShell
-
Contoh 1: Contoh ini membatalkan pendaftaran instans lokal dengan nama yang ditentukan.
Unregister-CDOnPremiseInstance -InstanceName AssetTag12010298EX
-
Untuk detail API, lihat DeregisterOnPremisesInstancedi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanUpdate-CDApplication
.
- Alat untuk PowerShell
-
Contoh 1: Contoh ini mengubah nama aplikasi yang ditentukan.
Update-CDApplication -ApplicationName MyNewApplication -NewApplicationName MyNewApplication-2
-
Untuk detail API, lihat UpdateApplicationdi Referensi Alat AWS untuk PowerShell Cmdlet.
-
Contoh kode berikut menunjukkan cara menggunakanUpdate-CDDeploymentGroup
.
- Alat untuk PowerShell
-
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 penerapan biru/hijau.
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 UpdateDeploymentGroupdi Referensi Alat AWS untuk PowerShell Cmdlet.
-