# How do I add environment labels to EC2 User data cloud-config?

**URL:** <https://forums.suse.com/t/how-do-i-add-environment-labels-to-ec2-user-data-cloud-config/6459>\
**Category:** Rancher 1.x\
**Created:** [May 25, 2017, 2:50am UTC](https://forums.suse.com/t/how-do-i-add-environment-labels-to-ec2-user-data-cloud-config/6459 "2017-05-25T02:50:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@Rob](https://forums.suse.com/u/Rob)\
**Post date:** [May 25, 2017, 2:50am UTC](https://forums.suse.com/t/how-do-i-add-environment-labels-to-ec2-user-data-cloud-config/6459/1 "2017-05-25T02:50:14Z")

</div>

I would add the environment labels like this - is this the correct?

```
  environment:
  CATTLE_HOST_LABELS: environment=production&hosttype=large

```

Full EC2 User data configurations (used to register agent and add label)

```
#cloud-config
rancher:
  services:
    register:
      privileged: true
      volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/rancher:/var/lib/rancher
      image: rancher/agent:v1.2.2
      command:
      - https://rancher.domain.com/v1/scripts/<token>
      environment:
      CATTLE_HOST_LABELS: environment=production&hosttype=large
```

---

<div class="post-metadata">

**Author:** ![superseb](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/superseb/32/2424_2.png) [@superseb](https://forums.suse.com/u/superseb)\
**Post date:** [June 29, 2017, 12:32pm UTC](https://forums.suse.com/t/how-do-i-add-environment-labels-to-ec2-user-data-cloud-config/6459/2 "2017-06-29T12:32:56Z")

</div>

I would say:

```auto
      environment:
        - CATTLE_HOST_LABELS='environment=production&hosttype=large'

```
