Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
coreos cloud-config file for dynamically mount aws efs in the right availability zone
#cloud-config
write-files:
- path: /etc/conf.d/nfs
permissions: '0644'
content: |
OPTS_RPC_MOUNTD=""
users:
- name: XYZ
groups:
- sudo
- docker
ssh-authorized-keys:
- ssh-rsa XYZ
coreos:
etcd:
discovery: https://discovery.etcd.io/XYZ
peer-addr: $private_ipv4:7001
units:
- name: rpc-statd.service
command: start
enable: true
- name: mnt-efs.mount
content: |
[Mount]
What=AZ_ZONE.fs-XYZ.efs.AMAZON_REGION.amazonaws.com:/
Where=/mnt/efs
Type=nfs
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: runcmd.service
command: start
content: |
[Unit]
Description=command
[Service]
Type=oneshot
ExecStart=/bin/sh -c "AZ_ZONE=$(curl -L http://169.254.169.254/latest/meta-data/placement/availability-zone); sed -i \"s/AZ_ZONE/$AZ_ZONE/\" /etc/systemd/system/mnt-efs.mount; systemctl daemon-reload; systemctl restart mnt-efs.mount"
@andymotta

This comment has been minimized.

Copy link

@andymotta andymotta commented Mar 8, 2016

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment