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.
Elastic Load Balancing - Contoh Versi 1 menggunakan Alat untuk V5 PowerShell
Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan 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 set 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 AttachLoadBalancerToSubnetsdi 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 AddTagsdi 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. Outputnya mencakup Availability Zone yang tersisa.
Disable-ELBAvailabilityZoneForLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2aOutput:
us-west-2b-
Untuk detail API, lihat DisableAvailabilityZonesForLoadBalancerdi 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 termasuk subnet yang tersisa.
Dismount-ELBLoadBalancerFromSubnet -LoadBalancerName my-load-balancer -Subnet subnet-12345678Output:
subnet-87654321-
Untuk detail API, lihat DetachLoadBalancerFromSubnetsdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanEdit-ELBLoadBalancerAttribute.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini memungkinkan penyeimbangan beban lintas zona untuk penyeimbang beban yang ditentukan.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -CrossZoneLoadBalancing_Enabled $trueContoh 2: Contoh ini menonaktifkan pengurasan koneksi untuk penyeimbang beban yang ditentukan.
Edit-ELBLoadBalancerAttribute -LoadBalancerName my-load-balancer -ConnectionDraining_Enabled $falseContoh 3: Contoh ini memungkinkan pencatatan 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 ModifyLoadBalancerAttributesdi 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 load balancer yang ditentukan. Outputnya mencakup daftar lengkap Availability Zones.
Enable-ELBAvailabilityZoneForLoadBalancer -LoadBalancerName my-load-balancer -AvailabilityZone us-west-2aOutput:
us-west-2a us-west-2b-
Untuk detail API, lihat EnableAvailabilityZonesForLoadBalancerdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-ELBInstanceHealth.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menjelaskan keadaan 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 keadaan 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 contoh 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 DescribeInstanceHealthdi 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 wilayah saat ini AWS .
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 DescribeLoadBalancersdi 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 DescribeLoadBalancerAttributesdi 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 DescribeLoadBalancerPoliciesdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanGet-ELBLoadBalancerPolicyType.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mendapatkan tipe 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 DescribeLoadBalancerPolicyTypesdi 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 DescribeTagsdi 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 ApplySecurityGroupsToLoadBalancerdi 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 dihasilkan aplikasi tertentu.
New-ELBAppCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-app-cookie-policy -CookieName my-app-cookie-
Untuk detail API, lihat CreateAppCookieStickinessPolicydi 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 hitungan 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 (agen pengguna).
New-ELBLBCookieStickinessPolicy -LoadBalancerName my-load-balancer -PolicyName my-duration-cookie-policy-
Untuk detail API, lihat CreateLbCookieStickinessPolicydi 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.comContoh 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.comContoh 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-
Untuk detail API, lihat CreateLoadBalancerdi 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 CreateLoadBalancerListenersdi 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 CreateLoadBalancerPolicydi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRegister-ELBInstanceWithLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mendaftarkan EC2 instance tertentu dengan penyeimbang beban yang ditentukan.
Register-ELBInstanceWithLoadBalancer -LoadBalancerName my-load-balancer -Instance i-12345678Output:
InstanceId ---------- i-12345678 i-87654321-
Untuk detail API, lihat RegisterInstancesWithLoadBalancerdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Contoh kode berikut menunjukkan cara menggunakanRemove-ELBInstanceFromLoadBalancer.
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini menghapus EC2 instance tertentu dari penyeimbang beban yang ditentukan. Anda diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika 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 DeregisterInstancesFromLoadBalancerdi 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 diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika 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 DeleteLoadBalancerdi 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 diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika 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 DeleteLoadBalancerListenersdi 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 diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika 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 DeleteLoadBalancerPolicydi 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 diminta untuk konfirmasi sebelum operasi berlangsung, kecuali jika 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 RemoveTagsdi 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 ConfigureHealthCheckdi 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 SetLoadBalancerListenerSslCertificatedi 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 SetLoadBalancerPoliciesForBackendServerdi 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 listener tertentu 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 listener tertentu.
Set-ELBLoadBalancerPolicyOfListener -LoadBalancerName my-load-balancer -LoadBalancerPort 443-
Untuk detail API, lihat SetLoadBalancerPoliciesOfListenerdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-