3

I've the following file in my cloud-init

write_files:
- path: /opt/data/conf.conf
  owner: root:root
  permissions: '0755'
  content: |
    [default]
    host = $HOSTNAME

I need to interpolate properly the variable $HOSTNAME when it is executed in an EC2 instance.

I didn't find anything about that in the documentation but I found EC2 datasource.

Any idea how to properly interpolate that value?

The quick idea I had is to write it inside an executable and interpolate from there. is it the only way?

Mazzy
  • 13,354
  • 43
  • 126
  • 207

0 Answers0