Versi 5 (V5) Alat AWS untuk PowerShell telah dirilis!
Untuk informasi tentang mengubah perubahan dan memigrasikan aplikasi Anda, lihat topik https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html migrasi.
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Elastic Load Balancing - Contoh Versi 1 menggunakan Alat untuk PowerShell V5
Contoh kode berikut menunjukkan cara melakukan tindakan dan menerapkan skenario umum dengan menggunakan Alat AWS untuk PowerShell V5 dengan Elastic Load Balancing - Versi 1.
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.
Topik
Tindakan
Contoh kode berikut menunjukkan cara menggunakanAdd-ELBLoadBalancerToSubnet.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menambahkan subnet yang ditentukan ke kumpulan subnet yang dikonfigurasi untuk penyeimbang beban yang ditentukan. Outputnya mencakup daftar lengkap subnet.
Add-ELBLoadBalancerToSubnet -LoadBalancerName my-load-balancer -Subnet subnet-12345678Output:
subnet-12345678 subnet-87654321-
Untuk detail API, lihat AttachLoadBalancerToSubnets di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanAdd-ELBResourceTag.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menambahkan tag yang ditentukan ke penyeimbang beban yang ditentukan. Sintaks yang digunakan oleh contoh ini memerlukan PowerShell versi 3 atau yang lebih baru.
Add-ELBResourceTag -LoadBalancerName my-load-balancer -Tag @{ Key="project";Value="lima" },@{ Key="department";Value="digital-media" }Contoh 2: Dengan PowerShell versi 2, Anda harus menggunakan New-Object untuk membuat tag untuk parameter Tag.
$tag = New-Object Amazon.ElasticLoadBalancing.Model.Tag $tag.Key = "project" $tag.Value = "lima" Add-ELBResourceTag -LoadBalancerName my-load-balancer -Tag $tag-
Untuk detail API, lihat AddTags di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanDisable-ELBAvailabilityZoneForLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus Availability Zone yang ditentukan dari load balancer yang ditentukan. Output mencakup Zona Ketersediaan yang tersisa.
Disable-ELBAvailabilityZoneForLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2aOutput:
us-west-2b-
Untuk detail API, lihat DisableAvailabilityZonesForLoadBalancer di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanDismount-ELBLoadBalancerFromSubnet.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus subnet yang ditentukan dari kumpulan subnet yang dikonfigurasi untuk penyeimbang beban yang ditentukan. Outputnya mencakup subnet yang tersisa.
Dismount-ELBLoadBalancerFromSubnet -LoadBalancerName my-load-balancer -Subnet subnet-12345678Output:
subnet-87654321-
Untuk detail API, lihat DetachLoadBalancerFromSubnets di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanEdit-ELBLoadBalancerAttribute.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengaktifkan penyeimbangan beban lintas zona untuk penyeimbang beban yang ditentukan.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -CrossZoneLoadBalancing_Enabled $trueContoh 2: Contoh ini menonaktifkan pengeringan koneksi untuk penyeimbang beban yang ditentukan.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -ConnectionDraining_Enabled $falseContoh 3: Contoh ini mengaktifkan logging akses untuk penyeimbang beban yang ditentukan.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer ` >> -AccessLog_Enabled $true ` >> -AccessLog_S3BucketName amzn-s3-demo-logging-bucket ` >> -AccessLog_S3BucketPrefix my-app/prod ` >> -AccessLog_EmitInterval 60-
Untuk detail API, lihat ModifyLoadBalancerAttributes di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanEnable-ELBAvailabilityZoneForLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menambahkan Availability Zone yang ditentukan ke penyeimbang beban yang ditentukan. Outputnya mencakup daftar lengkap Zona Ketersediaan.
Enable-ELBAvailabilityZoneForLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2aOutput:
us-west-2a us-west-2b-
Untuk detail API, lihat EnableAvailabilityZonesForLoadBalancer di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-ELBInstanceHealth.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menjelaskan status instance yang terdaftar dengan penyeimbang beban yang ditentukan.
Get-ELBInstanceHealth -LoadBalancerName my-load-balancerOutput:
Description InstanceId ReasonCode State ----------- ---------- ---------- ----- N/A i-87654321 N/A InService Instance has failed at lea... i-12345678 Instance OutOfServiceContoh 2: Contoh ini menjelaskan status instance tertentu yang terdaftar dengan penyeimbang beban yang ditentukan.
Get-ELBInstanceHealth -LoadBalancerName my-load-balancer -Instance i-12345678Contoh 3: Contoh ini menampilkan deskripsi lengkap dari keadaan instance yang ditentukan.
(Get-ELBInstanceHealth -LoadBalancerName my-load-balancer -Instance i-12345678).DescriptionOutput:
Instance has failed at least the UnhealthyThreshold number of health checks consecutively.-
Untuk detail API, lihat DescribeInstanceHealth di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-ELBLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mencantumkan nama penyeimbang beban Anda.
Get-ELBLoadBalancer | format-table -property LoadBalancerNameOutput:
LoadBalancerName ---------------- my-load-balancer my-other-load-balancer my-internal-load-balancerContoh 2: Contoh ini menjelaskan penyeimbang beban yang ditentukan.
Get-ELBLoadBalancer -LoadBalancerName my-load-balancerOutput:
AvailabilityZones : {us-west-2a, us-west-2b} BackendServerDescriptions : {Amazon.ElasticLoadBalancing.Model.BackendServerDescription} CanonicalHostedZoneName : my-load-balancer-1234567890.us-west-2.elb.amazonaws.com CanonicalHostedZoneNameID : Z3DZXE0EXAMPLE CreatedTime : 4/11/2015 12:12:45 PM DNSName : my-load-balancer-1234567890.us-west-2.elb.amazonaws.com HealthCheck : Amazon.ElasticLoadBalancing.Model.HealthCheck Instances : {i-207d9717, i-afefb49b} ListenerDescriptions : {Amazon.ElasticLoadBalancing.Model.ListenerDescription} LoadBalancerName : my-load-balancer Policies : Amazon.ElasticLoadBalancing.Model.Policies Scheme : internet-facing SecurityGroups : {sg-a61988c3} SourceSecurityGroup : Amazon.ElasticLoadBalancing.Model.SourceSecurityGroup Subnets : {subnet-15aaab61} VPCId : vpc-a01106c2Contoh 3: Contoh ini menjelaskan semua penyeimbang beban Anda di AWS wilayah saat ini.
Get-ELBLoadBalancerContoh 4: Contoh ini menjelaskan semua penyeimbang beban Anda di semua yang tersedia Wilayah AWS.
Get-AWSRegion | % { Get-ELBLoadBalancer -Region $_ }-
Untuk detail API, lihat DescribeLoadBalancers di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-ELBLoadBalancerAttribute.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menjelaskan atribut untuk penyeimbang beban yang ditentukan.
Get-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancerOutput:
AccessLog : Amazon.ElasticLoadBalancing.Model.AccessLog AdditionalAttributes : {} ConnectionDraining : Amazon.ElasticLoadBalancing.Model.ConnectionDraining ConnectionSettings : Amazon.ElasticLoadBalancing.Model.ConnectionSettings CrossZoneLoadBalancing : Amazon.ElasticLoadBalancing.Model.CrossZoneLoadBalancing-
Untuk detail API, lihat DescribeLoadBalancerAttributes di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-ELBLoadBalancerPolicy.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menjelaskan kebijakan yang terkait dengan penyeimbang beban yang ditentukan.
Get-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancerOutput:
PolicyAttributeDescriptions PolicyName PolicyTypeName --------------------------- ---------- -------------- {ProxyProtocol} my-ProxyProtocol-policy ProxyProtocolPolicyType {CookieName} my-app-cookie-policy AppCookieStickinessPolicyTypeContoh 2: Contoh ini menjelaskan atribut kebijakan yang ditentukan.
(Get-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-ProxyProtocol-policy).PolicyAttributeDescriptionsOutput:
AttributeName AttributeValue ------------- -------------- ProxyProtocol trueContoh 3: Contoh ini menjelaskan kebijakan yang telah ditentukan sebelumnya, termasuk kebijakan sampel. Nama-nama kebijakan sampel memiliki awalan ELBSample-.
Get-ELBLoadBalancerPolicyOutput:
PolicyAttributeDescriptions PolicyName PolicyTypeName --------------------------- ---------- -------------- {Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-05 SSLNegotiationPolicyType {Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-03 SSLNegotiationPolicyType {Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2015-02 SSLNegotiationPolicyType {Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2014-10 SSLNegotiationPolicyType {Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2014-01 SSLNegotiationPolicyType {Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSecurityPolicy-2011-08 SSLNegotiationPolicyType {Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSample-ELBDefaultCipherPolicy SSLNegotiationPolicyType {Protocol-SSLv2, Protocol-TLSv1, Pro... ELBSample-OpenSSLDefaultCipherPolicy SSLNegotiationPolicyType-
Untuk detail API, lihat DescribeLoadBalancerPolicies di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-ELBLoadBalancerPolicyType.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mendapatkan jenis kebijakan yang didukung oleh Elastic Load Balancing.
Get-ELBLoadBalancerPolicyTypeOutput:
Description PolicyAttributeTypeDescriptions PolicyTypeName ----------- ------------------------------- -------------- Stickiness policy with session lifet... {CookieExpirationPeriod} LBCookieStickinessPolicyType Policy that controls authentication ... {PublicKeyPolicyName} BackendServerAuthenticationPolicyType Listener policy that defines the cip... {Protocol-SSLv2, Protocol-TLSv1, Pro... SSLNegotiationPolicyType Policy containing a list of public k... {PublicKey} PublicKeyPolicyType Stickiness policy with session lifet... {CookieName} AppCookieStickinessPolicyType Policy that controls whether to incl... {ProxyProtocol} ProxyProtocolPolicyTypeContoh 2: Contoh ini menjelaskan jenis kebijakan yang ditentukan.
Get-ELBLoadBalancerPolicyType -PolicyTypeName ProxyProtocolPolicyTypeOutput:
Description PolicyAttributeTypeDescriptions PolicyTypeName ----------- ------------------------------- -------------- Policy that controls whether to incl... {ProxyProtocol} ProxyProtocolPolicyTypeContoh 3: Contoh ini menampilkan deskripsi lengkap dari jenis kebijakan yang ditentukan.
(Get-ELBLoadBalancerPolicyType -PolicyTypeName).DescriptionOutput:
Policy that controls whether to include the IP address and port of the originating request for TCP messages. This policy operates on TCP/SSL listeners only-
Untuk detail API, lihat DescribeLoadBalancerPolicyTypes di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-ELBResourceTag.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mencantumkan tag untuk penyeimbang beban yang ditentukan.
Get-ELBResourceTag -LoadBalancerName @("my-load-balancer","my-internal-load-balancer")Output:
LoadBalancerName Tags ---------------- ---- my-load-balancer {project, department} my-internal-load-balancer {project, department}Contoh 2: Contoh ini menjelaskan tag untuk penyeimbang beban yang ditentukan.
(Get-ELBResourceTag -LoadBalancerName my-load-balancer).TagsOutput:
Key Value --- ----- project lima department digital-media-
Untuk detail API, lihat DescribeTags di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanJoin-ELBSecurityGroupToLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menggantikan grup keamanan saat ini untuk penyeimbang beban yang ditentukan dengan grup keamanan yang ditentukan.
Join-ELBSecurityGroupToLoadBalancer -LoadBalancerName my-load-balancer -SecurityGroup sg-87654321Output:
sg-87654321Contoh 2: Untuk menjaga grup keamanan saat ini dan menentukan grup keamanan tambahan, tentukan grup keamanan yang ada dan yang baru.
Join-ELBSecurityGroupToLoadBalancer -LoadBalancerName my-load-balancer -SecurityGroup @("sg-12345678", "sg-87654321")Output:
sg-12345678 sg-87654321-
Untuk detail API, lihat ApplySecurityGroupsToLoadBalancer di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanNew-ELBAppCookieStickinessPolicy.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini membuat kebijakan lengket yang mengikuti masa pakai sesi lengket dari cookie yang dibuat aplikasi tertentu.
New-ELBAppCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-app-cookie-policy -CookieName my-app-cookie-
Untuk detail API, lihat CreateAppCookieStickinessPolicy di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanNew-ELBLBCookieStickinessPolicy.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini membuat kebijakan lengket dengan masa pakai sesi lengket yang dikendalikan oleh periode kedaluwarsa yang ditentukan (dalam detik).
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy -CookieExpirationPeriod 60Contoh 2: Contoh ini membuat kebijakan lengket dengan masa pakai sesi lengket yang dikendalikan oleh masa pakai browser (user-agent).
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy-
Untuk detail API, lihat CreateLbCookieStickinessPolicy di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanNew-ELBLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini membuat penyeimbang beban dengan pendengar HTTP di VPC.
$httpListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener $httpListener.Protocol = "http" $httpListener.LoadBalancerPort = 80 $httpListener.InstanceProtocol = "http" $httpListener.InstancePort = 80 New-ELBLoadBalancer -LoadBalancerName my-vpc-load-balancer -SecurityGroup sg-a61988c3 -Subnet subnet-15aaab61 -Listener $httpListener my-vpc-load-balancer-1234567890---us-west-2---elb.amazonaws.com.rproxy.govskope.caContoh 2: Contoh ini membuat penyeimbang beban dengan pendengar HTTP di EC2-Classic.
New-ELBLoadBalancer -LoadBalancerName my-classic-load-balancer -AvailabilityZone us-west-2a` -Listener $httpListenerOutput:
my-classic-load-balancer-123456789---us-west-2---elb.amazonaws.com.rproxy.govskope.caContoh 3: Contoh ini membuat penyeimbang beban dengan pendengar HTTPS.
$httpsListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener $httpsListener.Protocol = "https" $httpsListener.LoadBalancerPort = 443 $httpsListener.InstanceProtocol = "http" $httpsListener.InstancePort = 80 $httpsListener.SSLCertificateId="arn:aws:iam::123456789012:server-certificate/my-server-cert" New-ELBLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2a -Listener $httpsListener my-load-balancer-123456789---us-west-2---elb.amazonaws.com.rproxy.govskope.ca-
Untuk detail API, lihat CreateLoadBalancer di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanNew-ELBLoadBalancerListener.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menambahkan pendengar HTTPS ke penyeimbang beban yang ditentukan.
$httpsListener = New-Object Amazon.ElasticLoadBalancing.Model.Listener $httpsListener.Protocol = "https" $httpsListener.LoadBalancerPort = 443 $httpsListener.InstanceProtocol = "https" $httpsListener.InstancePort = 443 $httpsListener.SSLCertificateId="arn:aws:iam::123456789012:server-certificate/my-server-cert" New-ELBLoadBalancerListener -LoadBalancerName my-load-balancer -Listener $httpsListener-
Untuk detail API, lihat CreateLoadBalancerListeners di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanNew-ELBLoadBalancerPolicy.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini membuat kebijakan protokol proxy baru untuk penyeimbang beban tertentu.
$attribute = New-Object Amazon.ElasticLoadBalancing.Model.PolicyAttribute -Property @{ AttributeName="ProxyProtocol" AttributeValue="True" } New-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-ProxyProtocol-policy -PolicyTypeName ProxyProtocolPolicyType -PolicyAttribute $attribute-
Untuk detail API, lihat CreateLoadBalancerPolicy di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRegister-ELBInstanceWithLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mendaftarkan instance EC2 yang ditentukan dengan penyeimbang beban yang ditentukan.
Register-ELBInstanceWithLoadBalancer -LoadBalancerName my-load-balancer -Instance i-12345678Output:
InstanceId ---------- i-12345678 i-87654321-
Untuk detail API, lihat RegisterInstancesWithLoadBalancer di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRemove-ELBInstanceFromLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus instans EC2 yang ditentukan dari penyeimbang beban yang ditentukan. Anda akan diminta untuk konfirmasi sebelum operasi berlangsung, kecuali Anda juga menentukan parameter Force.
Remove-ELBInstanceFromLoadBalancer -LoadBalancerName my-load-balancer -Instance i-12345678Output:
Confirm Are you sure you want to perform this action? Performing operation "Remove-ELBInstanceFromLoadBalancer (DeregisterInstancesFromLoadBalancer)" on Target "Amazon.ElasticLoadBalancing.Model.Instance". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): InstanceId ---------- i-87654321-
Untuk detail API, lihat DeregisterInstancesFromLoadBalancer di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRemove-ELBLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus penyeimbang beban yang ditentukan. Anda akan diminta untuk konfirmasi sebelum operasi berlangsung, kecuali Anda juga menentukan parameter Force.
Remove-ELBLoadBalancer -LoadBalancerName my-load-balancerOutput:
Confirm Are you sure you want to perform this action? Performing operation "Remove-ELBLoadBalancer (DeleteLoadBalancer)" on Target "my-load-balancer". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):-
Untuk detail API, lihat DeleteLoadBalancer di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRemove-ELBLoadBalancerListener.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus pendengar pada port 80 untuk penyeimbang beban yang ditentukan. Anda akan diminta untuk konfirmasi sebelum operasi berlangsung, kecuali Anda juga menentukan parameter Force.
Remove-ELBLoadBalancerListener -LoadBalancerName my-load-balancer -LoadBalancerPort 80Output:
Confirm Are you sure you want to perform this action? Performing operation "Remove-ELBLoadBalancerListener (DeleteLoadBalancerListeners)" on Target "80". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):-
Untuk detail API, lihat DeleteLoadBalancerListeners di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRemove-ELBLoadBalancerPolicy.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus kebijakan yang ditentukan dari penyeimbang beban yang ditentukan. Anda akan diminta untuk konfirmasi sebelum operasi berlangsung, kecuali Anda juga menentukan parameter Force.
Remove-ELBLoadBalancerPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policyOutput:
Confirm Are you sure you want to perform this action? Performing operation "Remove-ELBLoadBalancerPolicy (DeleteLoadBalancerPolicy)" on Target "my-duration-cookie-policy". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):-
Untuk detail API, lihat DeleteLoadBalancerPolicy di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRemove-ELBResourceTag.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus tag yang ditentukan dari penyeimbang beban yang ditentukan. Anda akan diminta untuk konfirmasi sebelum operasi berlangsung, kecuali Anda juga menentukan parameter Force. Sintaks yang digunakan oleh contoh ini memerlukan PowerShell versi 3 atau yang lebih baru.
Remove-ELBResourceTag -LoadBalancerName my-load-balancer -Tag @{ Key="project" }Output:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-ELBResourceTag (RemoveTags)" on target "Amazon.ElasticLoadBalancing.Model.TagKeyOnly". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):Contoh 2: Dengan Powershell versi 2, Anda harus menggunakan New-Object untuk membuat tag untuk parameter Tag.
$tag = New-Object Amazon.ElasticLoadBalancing.Model.TagKeyOnly $tag.Key = "project" Remove-ELBResourceTag -Tag $tag -Force-
Untuk detail API, lihat RemoveTags di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanSet-ELBHealthCheck.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengonfigurasi pengaturan pemeriksaan kesehatan untuk penyeimbang beban yang ditentukan.
Set-ELBHealthCheck -LoadBalancerName my-load-balancer ` >> -HealthCheck_HealthyThreshold 2 ` >> -HealthCheck_UnhealthyThreshold 2 ` >> -HealthCheck_Target "HTTP:80/ping" ` >> -HealthCheck_Interval 30 ` >> -HealthCheck_Timeout 3Output:
HealthyThreshold : 2 Interval : 30 Target : HTTP:80/ping Timeout : 3 UnhealthyThreshold : 2-
Untuk detail API, lihat ConfigureHealthCheck di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanSet-ELBLoadBalancerListenerSSLCertificate.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menggantikan sertifikat yang mengakhiri koneksi SSL untuk pendengar yang ditentukan.
Set-ELBLoadBalancerListenerSSLCertificate -LoadBalancerName my-load-balancer ` >> -LoadBalancerPort 443 ` >> -SSLCertificateId "arn:aws:iam::123456789012:server-certificate/new-server-cert"-
Untuk detail API, lihat SetLoadBalancerListenerSslCertificate di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanSet-ELBLoadBalancerPolicyForBackendServer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menggantikan kebijakan untuk port yang ditentukan dengan kebijakan yang ditentukan.
Set-ELBLoadBalancerPolicyForBackendServer -LoadBalancerName my-load-balancer -InstancePort 80 -PolicyName my-ProxyProtocol-policyContoh 2: Contoh ini menghapus semua kebijakan yang terkait dengan port yang ditentukan.
Set-ELBLoadBalancerPolicyForBackendServer -LoadBalancerName my-load-balancer -InstancePort 80-
Untuk detail API, lihat SetLoadBalancerPoliciesForBackendServer di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanSet-ELBLoadBalancerPolicyOfListener.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menggantikan kebijakan untuk pendengar yang ditentukan dengan kebijakan yang ditentukan.
Set-ELBLoadBalancerPolicyOfListener -LoadBalancerName my-load-balancer -LoadBalancerPort 443 -PolicyName my-SSLNegotiation-policyContoh 2: Contoh ini menghapus semua kebijakan yang terkait dengan pendengar yang ditentukan.
Set-ELBLoadBalancerPolicyOfListener -LoadBalancerName my-load-balancer -LoadBalancerPort 443-
Untuk detail API, lihat SetLoadBalancerPoliciesOfListener di Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-