title: Termination Reason: Client.InternalError: Client error on launch
body: <p>please help</p>
  <p>How to make sure EC2 is using the custom KMS key; we are using terraform to deploy the EC2 instance, every time the EC2 instance is launched in an auto-scaling group, it crashes with the below error. Seems like the EC2 instance has no access to KMS key</p>
  <p><strong>Error:</strong> <em>Termination Reason: Client.InternalError: Client error on launch</em></p>
  <pre><code>resource &quot;aws_autoscaling_group&quot; &quot;autoscaling-group&quot; {
    name                 = var.name
    availability_zones   = var.availability_zones
    min_size             = var.min_size
    desired_capacity     = var.desired_capacity
    max_size             = var.max_size
    health_check_type    = &quot;EC2&quot;
    launch_configuration = aws_launch_configuration.launch_configuration.name
    vpc_zone_identifier  = local.subnet_id
    termination_policies = [&quot;OldestInstance&quot;]
  }
  
  resource &quot;aws_launch_configuration&quot; &quot;launch_configuration&quot; {
    name                        = var.name
    image_id                    = var.ami
    instance_type               = var.instance_type
    iam_instance_profile        = var.iam_instance_profile_name
    security_groups             = [aws_security_group.security_group.id]
    associate_public_ip_address = true
  }
  
  resource &quot;aws_autoscaling_policy&quot; &quot;autoscaling-policy&quot; {
    name                      = var.name
    policy_type               = &quot;TargetTrackingScaling&quot;
    estimated_instance_warmup = &quot;90&quot;
    adjustment_type           = &quot;ChangeInCapacity&quot;
    autoscaling_group_name    = aws_autoscaling_group.autoscaling-group.name
  }
  </code></pre>
  <p>--
  Thank you</p>