-
Notifications
You must be signed in to change notification settings - Fork 0
/
SSM
50 lines (29 loc) · 1.74 KB
/
SSM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
-------------- Hybrid Servers ---------------
https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-managed-instance-activation.html?shortFooter=true
**https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-install-managed-linux.html
sudo amazon-ssm-agent -register -code TR9NoCDSDLTQEgIna+l3 -id f787cd1d-7450-46b8-861a-d43d4680790d -region us-east-1
-------------------------------------------
sudo snap install amazon-ssm-agent --classic
sudo systemctl status snap.amazon-ssm-agent.amazon-ssm-agent.service
A good link:
https://aws.amazon.com/premiumsupport/knowledge-center/systems-manager-ec2-instance-not-appear/
SSM agent for userdata:
https://aws.amazon.com/premiumsupport/knowledge-center/install-ssm-agent-ec2-linux/
---------------------------------Python script that checks which instances managed through SSM-----------------------------
import boto3
ec2_instances = [i['InstanceId'] for r in boto3.client('ec2').describe_instances()['Reservations'] for i in r['Instances']]
ssm_instances = [i['InstanceId'] for i in boto3.client('ssm').describe_instance_information()['InstanceInformationList']]
print('EC2 instances:')
for count, s in enumerate(ec2_instances, 1):
print("{0}. {1}".format(count, s))
#print(ec2_instances)
print('SSM managed instances:')
for count, t in enumerate(ssm_instances, 1):
#for t in ssm_instances:
print("{0}. {1}".format(count, t))
#print(ssm_instances)
print('Unmanaged EC2 instances:')
print(set(ec2_instances) - set(ssm_instances))
- -- - - - - - - - - - - - - - -- - - - - - - -- - - -- Good link for the tutorial
https://cloudaffaire.com/how-to-add-an-ec2-instance-to-aws-system-manager-ssm/
https://cloudaffaire.com/how-to-add-an-ec2-instance-to-aws-system-manager-ssm/