createLoadBalancerPolicy
inline suspend fun ElasticLoadBalancingClient.createLoadBalancerPolicy(crossinline block: CreateLoadBalancerPolicyRequest.Builder.() -> Unit): CreateLoadBalancerPolicyResponse
Creates a policy with the specified attributes for the specified load balancer.
Policies are settings that are saved for your load balancer and that can be applied to the listener or the application server, depending on the policy type.
Samples
import aws.sdk.kotlin.services.elasticloadbalancing.model.PolicyAttribute
fun main() {
//sampleStart
// This example creates a policy that enables Proxy Protocol on the specified load balancer.
elasticLoadBalancingClient.createLoadBalancerPolicy {
loadBalancerName = "my-load-balancer"
policyName = "my-ProxyProtocol-policy"
policyTypeName = "ProxyProtocolPolicyType"
policyAttributes = listOf<PolicyAttribute>(
PolicyAttribute {
attributeName = "ProxyProtocol"
attributeValue = "true"
}
)
}
//sampleEnd
}
import aws.sdk.kotlin.services.elasticloadbalancing.model.PolicyAttribute
fun main() {
//sampleStart
// This example creates a public key policy.
elasticLoadBalancingClient.createLoadBalancerPolicy {
loadBalancerName = "my-load-balancer"
policyName = "my-PublicKey-policy"
policyTypeName = "PublicKeyPolicyType"
policyAttributes = listOf<PolicyAttribute>(
PolicyAttribute {
attributeName = "PublicKey"
attributeValue = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwAYUjnfyEyXr1pxjhFWBpMlggUcqoi3kl+dS74kj//c6x7ROtusUaeQCTgIUkayttRDWchuqo1pHC1u+n5xxXnBBe2ejbb2WRsKIQ5rXEeixsjFpFsojpSQKkzhVGI6mJVZBJDVKSHmswnwLBdofLhzvllpovBPTHe+o4haAWvDBALJU0pkSI1FecPHcs2hwxf14zHoXy1e2k36A64nXW43wtfx5qcVSIxtCEOjnYRg7RPvybaGfQ+v6Iaxb/+7J5kEvZhTFQId+bSiJImF1FSUT1W1xwzBZPUbcUkkXDj45vC2s3Z8E+Lk7a3uZhvsQHLZnrfuWjBWGWvZ/MhZYgEXAMPLE"
}
)
}
//sampleEnd
}
import aws.sdk.kotlin.services.elasticloadbalancing.model.PolicyAttribute
fun main() {
//sampleStart
// This example creates a backend server authentication policy that enables authentication on your
// backend instance using a public key policy.
elasticLoadBalancingClient.createLoadBalancerPolicy {
loadBalancerName = "my-load-balancer"
policyName = "my-authentication-policy"
policyTypeName = "BackendServerAuthenticationPolicyType"
policyAttributes = listOf<PolicyAttribute>(
PolicyAttribute {
attributeName = "PublicKeyPolicyName"
attributeValue = "my-PublicKey-policy"
}
)
}
//sampleEnd
}