title: No Instances found when trying to use AWS Console and EC2 Run Command for Windows
body: <p>I am trying to use the Amazon EC2 Run Command feature, and basically it says it can't find any instances.</p>
  
  <p>I read all the documentation and followed all the steps that I could find on this relatively new feature, and I cant get it to work for the life of me. </p>
  
  <p><strong><em>Here is the info:</em></strong></p>
  
  <p>I go to "EC2 -> Commands -> Command History -> Run A Command"
  I click radio box for the "AWS-RunShellScript" command document
  I click the "Select Instances" drop down button, and it says "No instances found in this region" as shown in Figure 1 below.</p>
  
  <p>I click the "Where are my instances?" hyperlink, which brings me to the AWS documentation show here:"<a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-remote-commands.html?icmpid=docs_ec2_console" rel="nofollow noreferrer">Troubleshooting SSM Run Command</a>"</p>
  
  <p>The first suggestion for troubleshooting is to make sure that the prerequisites have been met, and provides another hyperlink shown here: "<a href="http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/remote-commands-prereq.html" rel="nofollow noreferrer">SSM Run Command Prerequisites</a>"</p>
  
  <p>Prerequisites:</p>
  
  <ol>
  <li>Supported OS - Windows 2012 R2 - CHECK</li>
  <li>Latest Agent Version - 3.17.1032 - CHECK (Shown In Figure 2)</li>
  <li>Access to SSM Run Command - Assign EC2 Instance Role and IAM User Role - CHECK (Shown In Figures 3 and 4)</li>
  <li>Internet Access - Outbound Internet Access - CHECK</li>
  </ol>
  
  <p>I followed the AWS documentation for creating an Amazon EC2 Instance role for EC2 Run Command Access, and also to create an IAM User with proper Run Command Access. The documentation is shown here: <a href="http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/delegate-commands.html" rel="nofollow noreferrer">Delegating Access to SSM Run Command</a></p>
  
  <p>I used the Amazon CLI from my local machine to run the following command also shown in troubleshooting documentation:</p>
  
  <pre><code>aws ssm describe-instance-information --instance-information-filter-list key=InstanceIds,valueSet=instance-ID
  </code></pre>
  
  <p>The command returns no information:</p>
  
  <blockquote>
    <p>{
        "InstanceInformationList": []
    }</p>
  </blockquote>
  
  <p><strong><em>UPDATE 1:</em></strong></p>
  
  <p>I did find the following errors and warnings in the following places, and have spent the last two hours trying to troubleshoot. I uinstalled and reinstalled the Ec2Config Service. I checked all the Ec2Config files. I Checked the 169.254 addresses, and the meta-data and dynamic data exists, and appears to be correct. Not sure what else to try here.</p>
  
  <p><strong>C:\Program Files\Amazon\Ec2ConfigService\Logs\Ec2ConfigLog - Error/Warning</strong> </p>
  
  <blockquote>
    <p>2016-06-22T23:44:12.663Z: Warning: Unable to Publish to WMI. | System.Management.Instrumentation.WmiProviderInstallationException: Exception of type 'System.Management.Instrumentation.WMIInfraException' was thrown.
       at System.Management.Instrumentation.InstrumentationManager.Publish(Object value)
    2016-06-22T23:44:16.263Z: Failed to fetch instance metadata <a href="http://169.254.169.254/latest/user-data" rel="nofollow noreferrer">http://169.254.169.254/latest/user-data</a> with exception The remote server returned an error: (404) Not Found.
    2016-06-22T23:44:16.263Z: Failed to get metadata/user-data The remote server returned an error: (404) Not Found.</p>
  </blockquote>
  
  <p><strong>Windows Event Viewer Error</strong></p>
  
  <blockquote>
    <p>2016-06-22 23:46:59,758 [_Worker-2] ERROR [aws:getDocument] - Failed to update instance information., RequestId=9cb8f2dd-38d3-11e6-bc83-19c0650ffecc,ErrorCode=AccessDeniedException,ErrorType=Unknown,StatusCode=BadRequest,Message=Caller<br>
    instance identity does not match the given instanceId     </p>
  </blockquote>
  
  <p><strong><em>UPDATE 2:</em></strong></p>
  
  <p>Per @praetorian1 's linked stackoverflow article I updated the Ec2Config Services "config.xml" file to enable the "Ec2HandleUserData" setting, rebooted, and still no change.</p>
  
  <p>Per @Kai 's suggestion I also made sure that the "role" attached to the instance
  matched the "AmazonEC2RoleforSSM" policy, and specifically permitted "ssm:UpdateInstanceInformation". It did.</p>
  
  <p>I also looked under the AWS EC2 Management Console, at the "System Log" file for the specific instance, which did not contain any errors, and towards the end said that SSM Config: status:Active, iam:Yes. Also noteworthy, it contained: Info EC2Config configuration: status:2; region:us-east-1; iam:1; authz:1</p>
  
  <blockquote>
    <p>2016/06/23 15:01:29Z: EC2ConfigMonitorState: 0
    2016/06/23 15:01:29Z: Windows sysprep configuration complete.
    2016/06/23 15:01:32Z: AMI Origin Version: 2016.01.13
    2016/06/23 15:01:32Z: AMI Origin Name: Windows_Server-2012-R2_RTM-English-64Bit-SQL_2014_SP1_Web
    2016/06/23 15:01:32Z: OS: Microsoft Windows NT 6.3.9600
    2016/06/23 15:01:32Z: OsVersion: 6.3
    2016/06/23 15:01:32Z: OsProductName: Windows Server 2012 R2 Standard
    2016/06/23 15:01:32Z: OsBuildLabEx: 9600.18202.amd64fre.winblue_ltsb.160119-0600
    2016/06/23 15:01:32Z: Language: en-US
    2016/06/23 15:01:32Z: TimeZone: Eastern Standard Time
    2016/06/23 15:01:32Z: Offset: UTC -04:00:00
    2016/06/23 15:01:32Z: EC2 Agent: Ec2Config service v3.17.1032
    2016/06/23 15:01:32Z: Driver: AWS PV Storage Host Adapter v7.3.2.0
    2016/06/23 15:01:32Z: Driver: Intel(R) 82599 Virtual Function v1.0.15.3
    2016/06/23 15:01:34Z: Message: Waiting for meta-data accessibility...
    2016/06/23 15:01:34Z: Message: Meta-data is now available.
    2016/06/23 15:01:37Z: Message: Windows is Ready to use
    2016/06/23 15:01:40Z: Amazon EC2 Simple Systems Manager (SSM) is an optional service for custom configuration of instances.
    2016/06/23 15:01:40Z: Info EC2Config configuration: status:2; region:us-east-1; iam:1; authz:1
    2016/06/23 15:01:40Z: SSM Config: status:Active; iam:Yes</p>
  </blockquote>
  
  <p><strong>Figure 1:</strong>
  <a href="https://i.stack.imgur.com/0L6A7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0L6A7.png" alt="No Instances Found"></a></p>
  
  <p><strong>Figure 2:</strong>
  <a href="https://i.stack.imgur.com/Lihc4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lihc4.png" alt="EC2 SSM Agent"></a></p>
  
  <p><strong><a href="https://i.stack.imgur.com/bHCo0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bHCo0.png" alt="Figure 3:"></a></strong></p>
  
  <p><strong>Figure 4:</strong>
  <a href="https://i.stack.imgur.com/TTBqq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TTBqq.png" alt="RunCommandInstance Policy"></a></p>