Untitled
unknown
plain_text
a year ago
672 B
12
Indexable
import boto3
def get_ssm_command_history(limit=100):
# Initialize a boto3 SSM client
ssm_client = boto3.client('ssm')
# Retrieve the last 'limit' command invocations
response = ssm_client.list_command_invocations(
MaxResults=limit,
Details=False
)
# Extract the unique SSM document names
unique_ssm_docs = set(invocation['DocumentName'] for invocation in response['CommandInvocations'])
return unique_ssm_docs
if __name__ == "__main__":
# Query and print unique SSM document names
unique_docs = get_ssm_command_history(100)
print("Unique SSM Document Names:")
for doc in unique_docs:
print(doc)
Editor is loading...
Leave a Comment