Debian Buster container inside AWS ec2
Hi all,
I hope that you are doing very well in this hard times.
My name's Cauã (Brazilian) and i use Debian for many years. I'm building a new infrastructure inside AWS with terraform. We're migrating from CoreOS to Debian (choice me), but we're having a problem with userdata to create systemd with others containers to running inside Debian Buster (https://wiki.debian.org/Cloud/AmazonEC2Image/Buster).
See below a little example about my userdata. I can't found docs to help me. Could you help me, please ?
#cloud-config
systemd:
- name: "filebeat.service"
command: "start"
contents: |
[Unit]
Description=log shipper
After=${APP_NAME}.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=/bin/bash -c '/usr/bin/docker run -i --rm -v /tmp:/tmp quay.io/coreos/awscli:master aws ecr get-login \
--region us-east-1 --no-include-email 2>&1 > /tmp/token'
ExecStartPre=/bin/bash /tmp/token
ExecStartPre=/usr/bin/docker pull ${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/ecr-${ENV}-filebeat:latest
ExecStartPre=/bin/bash -c '/usr/bin/docker run -i --rm -v /etc/filebeat:/tmp quay.io/coreos/awscli:master \
aws s3 cp s3://wcd-${ENV}-cfgs/filebeat/filebeat-${APP_ALIAS}.yml /tmp/filebeat.yml'
ExecStartPre=/bin/bash -c '/usr/bin/docker run -i --rm -v /etc/filebeat/modules.d:/tmp quay.io/coreos/awscli:master \
aws s3 sync s3://wcd-${ENV}-cfgs/filebeat/modules.d/ /tmp/'
ExecStartPre=/bin/bash -c '/usr/bin/docker run -i --rm -v /etc/filebeat/module:/tmp quay.io/coreos/awscli:master \
aws s3 sync s3://wcd-${ENV}-cfgs/filebeat/module/ /tmp/'
ExecStart=/usr/bin/docker run -t --name filebeat \
--mount source=logs,target=/logs,readonly -e APP_NAME=${APP_ALIAS} -e ENVIRONMENT=${ENV} \
-v /etc/filebeat/filebeat.yml:/usr/share/filebeat/filebeat.yml \
-v /etc/filebeat/modules.d:/usr/share/filebeat/modules.d \
-v /etc/filebeat/module/:/usr/share/filebeat/module/ \
${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/ecr-${ENV}-filebeat:latest
ExecStop=/usr/sbin/logrotate /etc/logrotate.conf --force
ExecStop=-/usr/bin/docker rm -f filebeat
Restart=always
RestartSec=20
[Install]
WantedBy=multi-user.target
Many Thanks,
Best,
Cauã.
Sent with ProtonMail Secure Email.
Reply to: