AWS Elastic Load Balancing App Cookie Stickiness Policy

This page shows how to write Terraform and CloudFormation for Elastic Load Balancing App Cookie Stickiness Policy and write them securely.

aws_app_cookie_stickiness_policy (Terraform)

The App Cookie Stickiness Policy in Elastic Load Balancing can be configured in Terraform with the resource name aws_app_cookie_stickiness_policy. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L7
resource "aws_app_cookie_stickiness_policy" "this" {
  cookie_name   = var.cookie_name
  lb_port       = var.lb_port
  load_balancer = var.load_balancer
  name          = var.name
}

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides an application cookie stickiness policy, which allows an ELB to wed its sticky cookie's expiration to a cookie generated by your application.

Tips: Best Practices for The Other AWS Elastic Load Balancing Resources

In addition to the aws_elb, AWS Elastic Load Balancing has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_elb

Ensure to drop invalid headers at Elastic Load Balancing

It's better to drop them at Elastic Load Balancing. Passing invalid headers to the applications might cause issues like HTTP Request Smuggling.

Review your AWS Elastic Load Balancing settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

AWS::ElasticLoadBalancing::LoadBalancer AppCookieStickinessPolicy (CloudFormation)

The LoadBalancer AppCookieStickinessPolicy in ElasticLoadBalancing can be configured in CloudFormation with the resource name AWS::ElasticLoadBalancing::LoadBalancer AppCookieStickinessPolicy. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

CookieName The name of the application cookie used for stickiness.
Required: Yes
Type: String
Update requires: No interruption

PolicyName The mnemonic name for the policy being created. The name must be unique within a set of policies for this load balancer.
Required: Yes
Type: String
Update requires: No interruption

Explanation in CloudFormation Registry

Specifies a policy for application-controlled session stickiness for your Classic Load Balancer.

To associate a policy with a listener, use the PolicyNames property for the listener.

Frequently asked questions

AWS Elastic Load Balancing App Cookie Stickiness Policy is a resource for Elastic Load Balancing of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

For Terraform, the niveklabs/aws source code example is useful. See the Terraform Example section for further details.