Connecting installed SSM Agent to EC2 Instance

Hi everyone,

Any insights on making sure the SSM Agent connects properly?

I’m trying to install and connect Amazon SSM Agent on EC2 instances using Ansible but facing issues getting the SSM Agent connected to EC2. Despite installing the SSM Agent successfully and starting the service, the instances are not appearing as connected in Systems Manager.

My Code:

main.yml:

  • name: Clean yum cache
    command: yum clean all

  • name: Download SSM Agent for Amazon Linux 2
    get_url:
    url: “https://s3.amazonaws.com/amazon-ssm-us-east-1/latest/linux_amd64/amazon-ssm-agent.rpm
    dest: “/tmp/amazon-ssm-agent.rpm”

  • name: Install SSM Agent for Amazon Linux 2
    yum:
    name: /tmp/amazon-ssm-agent.rpm
    state: present
    disable_gpg_check: yes

  • name: Start and enable SSM Agent service
    service:
    name: amazon-ssm-agent
    state: started
    enabled: true

pb-install-ssm-agent.yml` file:
yaml

  • name: Install and configure Amazon SSM Agent on Amazon Linux 2
    hosts: all
    become: true
    roles:
    • role: ssm_agent

Software Versions:

  • Ansible: [Latest Version]
  • Amazon Linux 2 AMI
  • AWS Systems Manager (SSM)

This sounds more like a configuration issue of the software itself, not an ansible problem?

1 Like