Installing the third party software on windows ec2 server

How can i install software on my windows servers for the production environment and i don’t want to open the winrm and ports for that .

Could anyone help me to give some examples for user data…

If you don’t want to open up any ports or allow any external communication to the target server, you must basically rely on the bootstrap options provided by your cloud offering of choice.

In this case you said EC2, so you need to pass info along in the userdata field at launch:

Alternatively, you can prep a custom image via packer and then simply launch that. Some find that easier.