How to rename an AWS EC2 instance during provisioning using PowerShell

Share this:

In the Cloud era the VM/instance name is not that important, especially when we have a fleet of servers doing the same work, and that is key for scenarios where we have scaling up and down of applications. However, some IaaS workloads may require name, such as file servers, application servers and etc.

Solution


When provisioning a new instance on AWS EC2, on the Step 3: Configure Instance Details we have a a section called Advanced Details and the information provided on that point is executed during the first boot of the servers (when it is a Windows Server instance). We can use scripts and PowerShell to pass some instructions to the server.

image

Solution

If we want to rename, we can use the following PowerShell cmdlet, make sure to encapsulate the cmdlets with <powershell></powershell> tags. In the example below, we are renaming the new instance to SRV05.

<powershell>

Rename-Computer –NewName “SRV05” –Restart

</powershell>

11

Written by Anderson Patricio

Anderson Patricio

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson has been contributing to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).

Related Post

Managing Hyper-V Server remotely through PowerShel... Working with PowerShell can be very common for daily tasks and Hyper-V Server management. However, as there is more than one server to be managed, som...
Performing daily task with PowerShell to manage Hy... As a virtualization administrator, you will come across a lot of scenarios where you will need to create, modify, move, export, and other tasks to man...
Hyper-V 2012 Hotfixes: Where I can find it and how... After my session at TechEd about Best Practices for Virtualizing and Managing Microsoft SharePoint 2013 with Microsoft System Center 2012 R2 and Windo...
Using PowerShell to update a local folder from a c... In this Tutorial we will use PowerShell to update a local folder from a central repository using versioning control. You may be wondering what is the ...