title: Can we add a CNAME for an EC2 in Cloud Formation Template when ec2s are created using auto scaling?
body: <p>I am working with a kafka cluster on AWS, I would like to give each broker a CNAME so I can reference that rather than the IP address. </p>
  
  <p>I know usually with an EC2 we can do this in the cloud formation template using something like this.. </p>
  
  <pre><code>{
  "Parameters": {
      "TestCname":{
          "Description": "The IpAddress for the MyInstance Ec2",
          "Type": "String",
          "Default": "domainName.com"            
      }
  },
  "Resources": {
      "MyInstanceCNAME": {
          "Type": "Custom::ResourceDNS",
            "Version": "1.0",
            "Properties": {                                            
              "ServiceToken": { "Fn::Sub": "arn:aws:sns:${AWS::Region}:&lt;Account_Num&gt;:custom-resource" },
              "Resource": "CNAME",
              "CNAME": { "Ref": "TestCname" },
              "IpAddress" : { "Fn::GetAtt" : [ "MyInstance", "PrivateIp" ]}
          }
      },
      "MyInstance": {
          "Type": "AWS::EC2::Instance",
          "Properties": {
              "AvailabilityZone": "us-east-1a",
              "ImageId": "ami-a4c7edb2",
              "InstanceType": "t2.micro"}
      }
  }
  </code></pre>
  
  <p>The problem is that with confluent quickstart script for AWS </p>
  
  <p><a href="https://github.com/aws-quickstart/quickstart-confluent-kafka/blob/master/templates/confluent-kafka.template" rel="nofollow noreferrer">https://github.com/aws-quickstart/quickstart-confluent-kafka/blob/master/templates/confluent-kafka.template</a></p>
  
  <p>I initially thought the creation of the ec2s must be in the referenced templates eg. </p>
  
  <pre><code>Fn::Sub": "https://${QSS3BucketName}.s3.amazonaws.com/${QSS3KeyPrefix}templates/nodegroup.template
  </code></pre>
  
  <p>But I couldn't see the instantation in that template either and have just discovered through a guy on my team that the ec2s are being created through auto scaling.</p>
  
  <p>Can we add a CNAME and how is the question? 
  Thanks</p>