amazon web services - How can I load cloud-config from a remote source like S3? -


i running coreos server on amazon ec2. user-data provide server on boot long launch configuration handle. how solve this?

the path i'm going down send cloud-config yaml file s3, start server iam-role has access object on s3, download it, verify it, , install it. "install it" part proving tricky however.

my condensed cloud-config trying reference config on s3:

#cloud-config coreos:   update:     reboot-strategy: off    units:     - name: extra-cloudinit.service       command: start       content: |         [unit]         description=gets s3 cloud-config , runs it.          [service]         type=oneshot         remainafterexit=yes         execstart=-/bin/mkdir /cloud-init         execstart=/bin/docker run --rm -v /cloud-init/:/data/ pebbletech/docker-aws-cli aws s3 cp s3://my-deployment/cloud-config/cloud-init-v1.yaml /data/         execstart=/bin/bash -c 'cd /cloud-init/; echo "efc158573d28193f63887c911ac5b01af287d2dd  cloud-init-v1.yaml" | sha1sum -c -'         execstart=/usr/bin/coreos-cloudinit --from-file=/cloud-init/cloud-init-v1.yaml         execstart=/usr/bin/systemctl restart docker 

i add drop-in docker in cloud-config hosted on s3, need restart it. problem script never restarts docker. running execstart=/usr/bin/systemctl daemon-reload seems kill whole thing , restart , systemd get's caught in loop.

what missing? seems pretty common use case? anti-pattern? work around can move things user-data cloud-config, have main config in 2 places seems weird. i'd reference object in s3 user-data.

check out ignition, successor cloud-init. ignition runs before systemd starts, can avoid of issues.

ignition can fetch remote config:

{   "ignition": {     "version": "2.0.0",     "config": {       "replace": {         "source": "http://example.com/config.json",         "verification": { "hash": "sha512-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" }       }     }   } } 

you provide user-data cloud-config. docs fetching remote config: https://coreos.com/ignition/docs/latest/examples.html#replacing-the-config-with-a-remote-config


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -