6

Fleet Manager, an easy way to check in on an EC2 Windows instance

 2 years ago
source link: https://nodogmablog.bryanhogan.net/2022/01/fleet-manager-an-easy-way-to-check-in-on-an-ec2-windows-instance/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Fleet Manager, an easy way to check in on an EC2 Windows instance

I’ve been using EC2 Windows instances for a while and from time to time I want to check in on something, this usually involves opening up the RDP port in the security group, connecting, then reverting the security group change. Not too much trouble, but some security teams don’t like changes like that being made. If you don’t know how to setup an EC2 instance check out this post.

Fleet manager offers an alternative, a quick way to connect without requiring changes to the security group.

But you do need to add a security policy to the IAM role the instance is running under.

If you don’t know how to setup a Windows instance check this post.

If you already have an instance running, it will look something like this -

EC2_Instances_Summary_hubf7041e118efbee945c36f7bf8bf6e90_57906_1af06faa1f85b601a13bd1871bd49caf.png

Note how the IAM Role is blank in this example. Yours may be like this, or it may have a role.

For Fleet Manager to work you need an IAM Role assigned to the instance, and the role must have the AmazonSSMManagedInstanceCore policy attached.

Attaching the role

As mentioned above, your instance may or may not have an IAM role attached. Either way, the fix is the same, go to “Actions”, then “Security”, then “Modify IAM role”.

Modify_IAM_Role_hude5d8aff0676b6e7840deb91ce837b08_40166_2e3071e1a739bf6b263116563220cbce.png

You will see a screen like the one below, where the IAM role is blank. Click on “Create new IAM role”. (If there is an IAM role here already, you can modify that role instead of creating a new one.)

Modify_IAM_Role_2_hu2a2b63bfb529b2bd8f724023aebebabc_49596_53fc11177d05fe2740b5afd25ae9fb6b.png

On the next page, click “Create role”.

IAM_Roles_Create_role_hu4f054ff81fcab1380440a03d1c08ef50_28500_8cbf6e34c8030b48599e2b748ff623c4.png

This will bring you to a page with a variety of options, select EC2 near the top and hit “Next: Permissions”.

Create_role_select_type_hu939481fd78c9ad6055a390348b61a6f9_110523_a4853d8b5952de2e32f5b33deda06a1f.png

On the next page, you will add the policy needed to Fleet Manager to work, filter the list with “AmazonSSMManagedInstanceCore”, select that policy by ticking the box on the left. Hit “Next: Tags”.

Create_role_attach_policies_hu88d03078ea6ee342a55f9b4b68d50fb2_40562_1f1ef5b564b10044a10134e512e0edde.png

You can skip adding a tag, hit “Next: Review”. Now you’ll be on the review page, give the role a name, and hit “Crete role”.

Create_role_review_huce4ed2b22de2866d1aa985295bc56c49_67185_1f675fa111f9a114dba1ff1609d07627.png

Go back to the page where you were modifying the IAM role for the instance you are working on and select this new role from the dropdown list, you may need to hit the little reload icon to the right of the list. Hit “Save”.

Modify_IAM_Role_3_hu642fb26812076bd6b499e9cff50c50db_37462_9a3a369028d674ffb3f85f3d9707826e.png

You will now be back at the instance summary page, the IAM Role should now show the role you just attached.

EC2_Instances_Summary_2_hu002775faf637a9755b05dc066cf370a3_72089_caeec448654ce47f14d772aa83f66433.png

Even though you can see the role on the instance, it may take some more time before you can connect to the instance from Fleet Manager. In my experience, it usually happens within 10 minutes.

Connecting from the Fleet Manager

Head over to the Fleet Manager, and you should see something like the below. If you don’t, wait a few minutes more minutes and try again.

Fleet_Manager_hue7aa7e5ead8df532210f1a801e416ef7_46960_1e18c4aaf4d14f9f329801ef5f087c0c.png

Click on the “Node ID”, then on the new page, click Node Actions, and “Connect to With Remote Desktop”.

Fleet_Manager_node_actions_hu3fc9532df11c0cf92e8b76760cfa5c14_82524_e47cbcbfdbe327949b8ee7395bdaa51e.png

Finally, you need to authenticate yourself, you can use the key pair you generated when you created the instance, or another form of authentication like active directory credentials, or local machine credentials.

Fleet_Manager_key_pair_hu708f969fe993c3915d3927a675df25b0_71943_948696d57a80756b0a73f286c0087393.png

And then you will connect!

Fleet_Manager_connected_hu2817fe0c467fe83192d6cd89b7a28761_471225_59a3e09c1b528b603d0ef51e62811402.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK