I am currently in the process of using an AWS SSM Distributor package to install a monitoring agent across multiple AWS Accounts. For the agent install I need to pass a unique API Key for each account so I am using Parameter Store to pass through the API Key to the scripts within the distributor package.
This has been working without any issues on the vast majority of ec2 instances I have tested on. But I have now run into a few instances where the Env Var are not being passed through.
I thought this could be due to permissions on the ec2 instance, maybe they could not access the Parameter store but this is not the case. I have confirmed by connected to the instances and retrieving the Parameter using the AWS CLI (get-parameter).
Does anybody know what else might be causing this issue?
PS this is what I am passing through in the additional arguments section of AWS Distributor run command:
This issue was caused by the SSM Agent version on the failed instances not supporting Distributor Parameter support. This functionality was introduced at version 2.3.1550.0.
I would verify the EC2 instances all have the same security groups, and are on the same subnets. How are you creating the EC2 instances? Beanstalk, CFN Template and EC2 Instance, Launch Template, or doing it through a wizard?
The EC2 instances do fall into a few different security groups, however within those security groups the majority of deployments have been successful with only a few instances failing and I cannot see any difference between a successful instance and a failed instance (same ami, sg, subnet etc).
Each different account belongs to a different business unit who each have their own ways of creating the instances. So there is not set way each instance is created. This is why I thought the best way to pass through the API key was during the run-time of the package.
If you are able to ssh or direct connect into the instances either ‘cat /var/logs/cloud-init’ log files and compare. You can probably ‘cat /var/logs/cloud-init | grep error’ maybe something failed in the init. What Linux distro are you using?
A few other things I am thinking, are you using IMDV2 or V1 (Metadata Tokens required or optional). If you are using http://169.254.169.254/latest/meta-data and some Bus are making the tokens required tagt could be failing if you are not getting the token.
Depending on the BU if they have to aplly specific tags for your bootstrap sequence, or maybe a BU has different EC2 instance profiles that have different privs. Or even the role/user deploying the instance may not have the privs to pass the proper role.
Honestly there are so many issues you need to start narrowing down things to even ask for help. Its like you are on a gardening sub reddit and you asked why did my plants die? There are so many factors, that you need to specify your processes, and your distro, before anyone can effectively help you.
Are you having the same version of Systems Manager agent installed on all of the instances? Distributor Parameter support is most likely missing from older agent versions.
This is an issue with the SSM Agent version on the failed instances not supporting Distributor Parameter support. See release notes
----------
I think this is were the issue may lie. When looking at some of the failed instances, their ssm agent versions are 2.3.479.0 and 2.3.714.0.
Compared to the successful deployments are all on 3.0.1295.0. Will go through the release notes to see if I can find an entry for Distributor Parameter support.