<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=SSM</id>
	<title>SSM - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=SSM"/>
	<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=SSM&amp;action=history"/>
	<updated>2026-05-16T18:27:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://dikapediav2.com/wiki/index.php?title=SSM&amp;diff=171&amp;oldid=prev</id>
		<title>Ardika Sulistija: Created page with &quot;  ====Run Command Troubleshooting Checklist==== ----  * Verify if the instance is online (SSM agent pre-requisites). Is the Agent up to date? * Verify if SSM document supports the type of instance you want to target (Windows and Linux) * Ask for command ID and verify the status in SSM K2 page from SSM dashboard or from Admiral page. * Check the logs and the stdout location: ** The agent also stores the script (_script.ps1) and outputs (stderr and stdout) in the worker (&lt;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=SSM&amp;diff=171&amp;oldid=prev"/>
		<updated>2024-09-11T14:26:49Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;  ====Run Command Troubleshooting Checklist==== ----  * Verify if the instance is online (SSM agent pre-requisites). Is the Agent up to date? * Verify if SSM document supports the type of instance you want to target (Windows and Linux) * Ask for command ID and verify the status in SSM K2 page from SSM dashboard or from Admiral page. * Check the logs and the stdout location: ** The agent also stores the script (_script.ps1) and outputs (stderr and stdout) in the worker (&amp;lt;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
====Run Command Troubleshooting Checklist====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
* Verify if the instance is online (SSM agent pre-requisites). Is the Agent up to date?&lt;br /&gt;
* Verify if SSM document supports the type of instance you want to target (Windows and Linux)&lt;br /&gt;
* Ask for command ID and verify the status in SSM K2 page from SSM dashboard or from Admiral page.&lt;br /&gt;
* Check the logs and the stdout location:&lt;br /&gt;
** The agent also stores the script (_script.ps1) and outputs (stderr and stdout) in the worker (&amp;lt;b&amp;gt;Orchestration&amp;lt;/b&amp;gt;) folders located at:&lt;br /&gt;
*** /var/lib/amazon/ssm/&amp;lt;instanceID&amp;gt;/document/orchestration/&amp;lt;RunCommandId&amp;gt;/plug-in/step_number.plugin&amp;gt;/std*&lt;br /&gt;
&lt;br /&gt;
 /var/lib/amazon/ssm/&amp;lt; i-xxxxxxxxxxxx&amp;gt;/document/orchestration/&amp;lt;command ID&amp;gt;/awsrunShellScript/[PatchLinux or runInSpecLinux for example]/stdout&lt;br /&gt;
 &lt;br /&gt;
 /var/lib/amazon/ssm/&amp;lt;i-instanceid&amp;gt;/document/orchestration/&amp;lt;command ID&amp;gt;/awsrunShellScript/[PatchLinux or runInSpecLinux for example]/stderr&lt;br /&gt;
 &lt;br /&gt;
 # example: &amp;quot;runInSpecLinux&amp;quot;&lt;br /&gt;
 /var/lib/amazon/ssm/i-0bb46bc5e41a7a36b/document/orchestration/6b141723-0c4b-4726-8770-bc8eed816007/awsrunShellScript/runInSpecLinux/stdout&lt;br /&gt;
 &lt;br /&gt;
 # If the command action is  aws:runCommand :&lt;br /&gt;
 /var/lib/amazon/ssm/&amp;lt;i-instanceid&amp;gt;/document/orchestration/&amp;lt;command ID&amp;gt;/awsrunDocument/&amp;lt;stepName&amp;gt;/std*&lt;br /&gt;
&lt;br /&gt;
* Manual execution from instance? &lt;br /&gt;
* Check the Run command advanced playbooks.&lt;br /&gt;
* Reproduce issue&lt;br /&gt;
* Cut a TT/SIM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Logs====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
* /var/log/amazon/ssm&lt;br /&gt;
&lt;br /&gt;
You can view SSM Agent logs on instances in the following locations:&lt;br /&gt;
 /var/log/amazon/ssm/amazon-ssm-agent.log &lt;br /&gt;
 &lt;br /&gt;
 /var/log/amazon/ssm/errors.log&lt;br /&gt;
 &lt;br /&gt;
 /var/log/amazon/ssm/audits/amazon-ssm-agent-audit-YYYY-MM-DD&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Checking command logs:&lt;br /&gt;
 &lt;br /&gt;
here is path (replace instance id and command id)&lt;br /&gt;
&lt;br /&gt;
 /var/lib/amazon/ssm/&amp;lt;i-instanceid&amp;gt;/document/orchestration/&amp;lt;command ID&amp;gt;/awsrunShellScript/PatchLinux/stdout&lt;br /&gt;
 &lt;br /&gt;
 /var/lib/amazon/ssm/&amp;lt;i-instanceid&amp;gt;/document/orchestration/&amp;lt;command ID&amp;gt;/awsrunShellScript/PatchLinux/stderr&lt;br /&gt;
 &lt;br /&gt;
 # If the command action is  aws:runCommand :&lt;br /&gt;
 /var/lib/amazon/ssm/&amp;lt;i-instanceid&amp;gt;/document/orchestration/&amp;lt;command ID&amp;gt;/awsrunDocument/&amp;lt;stepName&amp;gt;/std*&lt;br /&gt;
&lt;br /&gt;
====How to install SSM Agent====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Manually install SSM Agent on EC2 instances for Linux &lt;br /&gt;
https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to reboot managed instance once by using custom Run Command document====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Yaml template:&lt;br /&gt;
 --- &lt;br /&gt;
 description: &amp;quot;Command Document Example JSON Template&amp;quot;&lt;br /&gt;
 mainSteps: &lt;br /&gt;
   - &lt;br /&gt;
     action: &amp;quot;aws:runShellScript&amp;quot;&lt;br /&gt;
     inputs: &lt;br /&gt;
       runCommand: &lt;br /&gt;
         - |-&lt;br /&gt;
             #!/bin/bash&lt;br /&gt;
             REBOOT_INDICATOR=/var/lib/amazon/ssm/ssm-reboot-indicator&lt;br /&gt;
             echo &amp;#039;Rebooting the host via SSM&amp;#039;&lt;br /&gt;
             if [ ! -f ${REBOOT_INDICATOR} ]; then&lt;br /&gt;
               uptime&lt;br /&gt;
               echo &amp;#039;rebooting... as the reboot file does not exist&amp;#039;&lt;br /&gt;
               touch ${REBOOT_INDICATOR}&lt;br /&gt;
               exit 194&lt;br /&gt;
             else&lt;br /&gt;
               echo &amp;#039;reboot file exist&amp;#039;&lt;br /&gt;
               ls -l ${REBOOT_INDICATOR} &lt;br /&gt;
               uptime &lt;br /&gt;
               rm -f ${REBOOT_INDICATOR}&lt;br /&gt;
               exit 0&lt;br /&gt;
             fi&lt;br /&gt;
     name: example&lt;br /&gt;
 schemaVersion: &amp;quot;2.2&amp;quot;&lt;br /&gt;
* It first checks if the reboot tracker file (/var/lib/amazon/ssm/ssm-reboot-indicator) exists in the &amp;#039;if&amp;#039; condition. If it does not, then it will create it, run mkfs, and then reboot it by sending out exit 194. &lt;br /&gt;
&lt;br /&gt;
* Once the system reboots, then it will go through the entire script again. Now since the reboot tracker does exist, it will remove the file and return exit 0. &lt;br /&gt;
&lt;br /&gt;
* The use of this if-else statement and the reboot tracker file helps prevent the instance from going into a reboot-loop. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 --- &lt;br /&gt;
 description: &amp;quot;Command Document Example JSON Template&amp;quot;&lt;br /&gt;
 mainSteps: &lt;br /&gt;
   - &lt;br /&gt;
     action: &amp;quot;aws:runShellScript&amp;quot;&lt;br /&gt;
     inputs: &lt;br /&gt;
       runCommand: &lt;br /&gt;
         - |-&lt;br /&gt;
             #!/bin/bash&lt;br /&gt;
             REBOOT_INDICATOR=/var/lib/amazon/ssm/ssm-reboot-indicator&lt;br /&gt;
             echo &amp;#039;Mounting volume and Rebooting the host via SSM&amp;#039;&lt;br /&gt;
             mount -a&lt;br /&gt;
             if [ ! -f ${REBOOT_INDICATOR} ]; then&lt;br /&gt;
               uptime&lt;br /&gt;
               echo &amp;#039;Creating filesystem on /dev/nvme1n1&amp;#039;&lt;br /&gt;
               mkfs -t ext4 /dev/nvme1n1&lt;br /&gt;
               echo &amp;#039;rebooting... as the reboot file does not exist&amp;#039;&lt;br /&gt;
               touch ${REBOOT_INDICATOR}&lt;br /&gt;
               exit 194&lt;br /&gt;
             else &lt;br /&gt;
               echo &amp;#039;reboot file exist, the server has been rebooted after mounting&amp;#039;&lt;br /&gt;
               ls -l ${REBOOT_INDICATOR}&lt;br /&gt;
               uptime&lt;br /&gt;
               rm -f ${REBOOT_INDICATOR}&lt;br /&gt;
               exit 0&lt;br /&gt;
             fi&lt;br /&gt;
     name: example&lt;br /&gt;
 schemaVersion: &amp;quot;2.2&amp;quot;&lt;/div&gt;</summary>
		<author><name>Ardika Sulistija</name></author>
	</entry>
</feed>