Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EC2 Userdata for proxy setup of SSM Agent on Amazon Linux 2
#!/usr/bin/env bash
mkdir -p /etc/systemd/system/amazon-ssm-agent.service.d
echo "[Service]" > /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
echo 'Environment="https_proxy=http://proxy:3128"' >> /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
echo 'Environment="http_proxy=http://proxy:3128"' >> /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
echo 'Environment="no_proxy=169.254.169.254"' >> /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
chmod 777 /etc/systemd/system/amazon-ssm-agent.service.d/override.conf
systemctl stop amazon-ssm-agent
systemctl daemon-reload
systemctl restart amazon-ssm-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment