Table: aws_ssm_managed_instance - Query AWS SSM Managed Instances using SQL
The AWS Systems Manager Managed Instance is a compute resource in your environment that is configured for use with AWS Systems Manager. These can be Amazon EC2 instances or servers and virtual machines (VMs) in your on-premises environment. They provide secure and scalable configuration and automation management, enabling you to automate administrative tasks, apply compliance policies, and manage resources across your environment.
Table Usage Guide
The aws_ssm_managed_instance
table in Steampipe provides you with information about managed instances within AWS Systems Manager (SSM). This table allows you, as a DevOps engineer, to query managed instance-specific details, including instance ID, name, platform type, platform version, and associated metadata. You can utilize this table to gather insights on instances, such as their operational status, last ping time, agent version, and more. The schema outlines the various attributes of the managed instance for you, including the instance ARN, registration date, resource type, and associated tags.
Examples
Basic info
Gain insights into the status and characteristics of managed instances in AWS Simple Systems Manager (SSM). This can help in monitoring and managing resources effectively, identifying any issues with association status or outdated agent versions, and understanding the distribution of resources across different platform types.
select instance_id, arn, resource_type, association_status, agent_version, platform_typefrom aws_ssm_managed_instance;
select instance_id, arn, resource_type, association_status, agent_version, platform_typefrom aws_ssm_managed_instance;
List managed instances with no associations
Determine the areas in which managed instances lack associations. This could be useful in identifying potential gaps in your resource management, allowing for more efficient allocation and utilization of resources.
select instance_id, arn, resource_type, association_statusfrom aws_ssm_managed_instancewhere association_status is null;
select instance_id, arn, resource_type, association_statusfrom aws_ssm_managed_instancewhere association_status is null;
List EC2 instances not managed by SSM
Determine the areas in which EC2 instances are not managed by the Systems Manager (SSM) to identify potential gaps in your management strategy. This query is useful for ensuring all instances are appropriately managed and can highlight areas needing attention.
select i.instance_id, i.arn, m.instance_id is not null as ssm_managedfrom aws_ec2_instance i left join aws_ssm_managed_instance m on m.instance_id = i.instance_idwhere m.instance_id is null;
select i.instance_id, i.arn, case when m.instance_id is not null then 1 else 0 end as ssm_managedfrom aws_ec2_instance i left join aws_ssm_managed_instance m on m.instance_id = i.instance_idwhere m.instance_id is null;
Control examples
- AWS Foundational Security Best Practices > SSM > 1 EC2 instances should be managed by AWS Systems Manager
- AWS Foundational Security Best Practices > SSM > 2 All EC2 instances managed by Systems Manager should be compliant with patching requirements
- AWS Foundational Security Best Practices > SSM > 3 Instances managed by Systems Manager should have an association compliance status of COMPLIANT
- CIS AWS Compute Services Benchmark v1.0.0 > 2 Elastic Cloud Compute (EC2) > 2.9 Ensure use of AWS Systems Manager to manage EC2 instances
- EC2 instances should be managed by AWS Systems Manager
- SSM managed instance associations should be compliant
- SSM managed instance patching should be compliant
Schema for aws_ssm_managed_instance
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
activation_id | text | = | The activation ID created by Systems Manager when the server or VM was registered. |
agent_version | text | = | The version of SSM Agent running on your Linux instance. |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
arn | text | The Amazon Resource Name (ARN) specifying the instance. | |
association_overview | jsonb | Information about the association. | |
association_status | text | = | The status of the association. |
computer_name | text | The fully qualified host name of the managed instance. | |
iam_role | text | The Identity and Access Management (IAM) role assigned to the on-premises Systems Manager managed node. | |
instance_id | text | = | The ID of the instance. |
ip_address | inet | The IP address of the managed instance. | |
is_latest_version | boolean | Indicates whether the latest version of SSM Agent is running on your Linux Managed Instance. | |
last_association_execution_date | timestamp with time zone | The date the association was last run. | |
last_ping_date_time | timestamp with time zone | The date and time when the agent last pinged the Systems Manager service. | |
last_successful_association_execution_date | timestamp with time zone | The last date the association was successfully run. | |
name | text | The name assigned to an on-premises server or virtual machine (VM) when it is activated as a Systems Manager managed instance. | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
ping_status | text | = | Connection status of SSM Agent. |
platform_name | text | The name of the operating system platform running on your instance. | |
platform_type | text | = | The operating system platform type. |
platform_version | text | The version of the OS platform running on your instance. | |
region | text | The AWS Region in which the resource is located. | |
registration_date | timestamp with time zone | The date the server or VM was registered with AWS as a managed instance. | |
resource_type | text | = | The type of instance. Instances are either EC2 instances or managed instances. |
source_id | text | The ID of the source resource. For IoT Greengrass devices, SourceId is the Thing name. | |
source_type | text | The type of the source resource. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_ssm_managed_instance