0

I use SSM to connection to windows ec2 instances with the cli: aws ssm start-session --target <id>

It takes the ssm service on a windows instance a few mins to start sometimes

I can check when its done initializing like this aws ec2 wait instance-status-ok --instance-ids <id>

But even after its done initializing it frequently takes another 30 secs or a min to start the agent- sometimes even more

I really dont want to write my own logic/polling script for doing this

Is there some aws cli command that uses run command or something to poll for when an instance is connected like aws ec2 wait instance-status-ok ?

EDIT: so there is this aws ssm get-connection-status but if a wait command exists Id much prefer it so I dont need to have my own logic/while loop.

red888
  • 4,069
  • 16
  • 58
  • 104
  • Curious about your use case. Why not just start the instance and then give it 10 minutes before you connect? Or if it's a dos script use "pause 120"? If you need something done as soon as an instance is created you might be best using automatino. – Tim Jul 03 '20 at 18:15
  • this is for automation. want to connect and execute something on the instance as soon as it is connected to ssm – red888 Jul 03 '20 at 18:19
  • Can you please edit your question to provide more context and details, such as what you're trying to install and why you think you need to connect manually using session manager. SSM is a manual way of doing things, you might find other techniques such as gold images or automated deployment works better for you. – Tim Jul 04 '20 at 04:32

0 Answers0