In this post i will show you how can we restart a windows ec2 instance by using powershell.
1. Go to your account, select Security Credentials and create an AWS access key and secret key.
2. Open Power-Shell for AWS, which will ask your AWS Access key and Secret Key.
3. If Power-Shell not prompted for keys go to “C:\Users\Administrator\AppData\Local\AWSToolkit” and delete the Registered Account Jsonfile and open Power-Shell again.
4. Now get your instance id by using this url from EC2 instance
5. Now from powershell give below command
Restart-EC2Instance -InstanceId i-12345678