rename window EC2 server and TAG name

0

I need to change the name of multiple windows ec2 instances.

manual way is:

  1. RDP to server
  2. Change name in system
  3. Reboot
  4. Change TAG Name from NAme: old_Name to new_name

any idea how I can automate this, script with powershell or SSM?

1 Answer
0

Hi Drago,

You should be able to do this using AWS Systems Manager / SSM Automation. The runbook can have the following basic steps:

  1. Describe the Instance. (To get details of the Instance) - Use the aws:executeAwsApi action.
  2. Confirm the instance is managed by SSM and its connection status is "Online". - Use the aws:assertAwsResourceProperty action
  3. Call / Invoke the AWS-RunPowerScript Run Command document to run a PowerShell Script that Renames the Computer. You can use the Rename-Computer PowerShell cmdlet - Use the aws:runCommand action.
  4. Tag the instance. - Use the aws:executeAwsApi action.
  5. Restart the Instance. - Use the aws:changeInstanceState action.

Reference: [+] Authoring Automation runbooks - https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-authoring-runbooks.html

AWS
answered a year ago
  • not sure how to start on this. I have no SSM experience. I know my ec2 instances are windows servers and have the SSM agent installed

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions