AWS Amazon EC2 Auto Scaling Group Tag

This page shows how to write Terraform and CloudFormation for Amazon EC2 Auto Scaling Group Tag and write them securely.

aws_autoscaling_group_tag (Terraform)

The Group Tag in Amazon EC2 Auto Scaling can be configured in Terraform with the resource name aws_autoscaling_group_tag. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

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

The following arguments are supported:

  • autoscaling_group_name - (Required) The name of the Autoscaling Group to apply the tag to.
  • tag - (Required) The tag to create. The tag block is documented below.

The tag block supports the following arguments:

  • key - (Required) Tag name.
  • value - (Required) Tag value.
  • propagate_at_launch - (Required) Whether to propagate the tags to instances launched by the ASG.

In addition to all arguments above, the following attributes are exported:

  • id - ASG name and key, separated by a comma (,)

Explanation in Terraform Registry

Manages an individual Autoscaling Group (ASG) tag. This resource should only be used in cases where ASGs are created outside Terraform (e.g., ASGs implicitly created by EKS Node Groups).

NOTE: This tagging resource should not be combined with the Terraform resource for managing the parent resource. For example, using aws_autoscaling_group and aws_autoscaling_group_tag to manage tags of the same ASG will cause a perpetual difference where the aws_autoscaling_group resource will try to remove the tag being added by the aws_autoscaling_group_tag resource. NOTE: This tagging resource does not use the provider ignore_tags configuration.

Tips: Best Practices for The Other AWS Amazon EC2 Auto Scaling Resources

In addition to the aws_launch_configuration, AWS Amazon EC2 Auto Scaling has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_launch_configuration

Check public IPs should be given to Auto Scaling instances

It is better to block public access on the Internet to them. It is better to avoid associating public IP addresses if this is unintentional.

Review your AWS Amazon EC2 Auto Scaling 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::AutoScaling::AutoScalingGroup TagProperty (CloudFormation)

The AutoScalingGroup TagProperty in AutoScaling can be configured in CloudFormation with the resource name AWS::AutoScaling::AutoScalingGroup TagProperty. 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

Key The tag key.
Required: Yes
Type: String
Minimum: 1
Maximum: 128
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Update requires: No interruption

PropagateAtLaunch Set to true if you want CloudFormation to copy the tag to EC2 instances that are launched as part of the Auto Scaling group. Set to false if you want the tag attached only to the Auto Scaling group and not copied to any instances launched as part of the Auto Scaling group.
Required: Yes
Type: Boolean
Update requires: No interruption

Value The tag value.
Required: Yes
Type: String
Minimum: 0
Maximum: 256
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Update requires: No interruption

Explanation in CloudFormation Registry

TagProperty specifies a tag for the Tags property of AWS::AutoScaling::AutoScalingGroup. TagProperty adds tags to all associated instances in an Auto Scaling group. For more information, see Tagging Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide. You can find a sample template snippet in the Examples section of the AWS::AutoScaling::AutoScalingGroup documentation.

CloudFormation adds the following tags to all Auto Scaling groups and associated instances: + aws:cloudformation:stack-name+ aws:cloudformation:stack-id+ aws:cloudformation:logical-id

Frequently asked questions

What is AWS Amazon EC2 Auto Scaling Group Tag?

AWS Amazon EC2 Auto Scaling Group Tag is a resource for Amazon EC2 Auto Scaling of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.