How to change windows hostname while launching in amazon cloudformation template - windows

I want to mention the host name of the instance in the Cloud Formation Template while launching the teplate for a windows instance. How can I do that?

The user data field is not getting executed since it was not enabled. Need to enable user-data in ec2-config in windows machine and stop the machine and then take the AMI. By using new AMI this would work.

Related

How to make windows EC2 user data script NOT run when I RDP to EC2?

The user data on Windows EC2 works as expected when EC2 is launched programmatically by Lambda. However, it also executes when I manually start the machine and RDP into it for debugging/troubleshooting purposes. Is there a way to make sure it doesn't run when I start EC2 and RDP to it?
Well, EC2 user data doesn't differentiate between programmatic and manual launching. Commenting out user data script before RDP'ing into EC2 looks like the only way to prevent user data script from running.

Installing Software on an AWS EC2 Windows 2019 Instance

Do EC2 instances automatically save changes made inside a running instance?
For example, after creating an EC2 Windows 2019 instance, I login as Administrator using RDP and install some software. If the EC2 instance is terminated or rebooted, will the software still be installed when I restart the EC2 instance?
In layman terms, you should consider your EC2 instance as a new virtual machine running on cloud. Terminate is used to delete an EC2 instance. AWS docs say:
An instance reboot is equivalent to an operating system reboot. In most cases, it takes only a few minutes to reboot your instance. When you reboot an instance, it keeps its public DNS name (IPv4), private IPv4 address, IPv6 address (if applicable), and any data on its instance store volumes.
If you terminate the instance its lost but if you restart the instance all the installed softwares will be there but if you want to create another instance with the same packages installed then you can create AMI out of instance and next time use that AMI to create new instance and all softwares will be preinstalled in the new win instance

Error connecting from CLI to AWS windows 2016 instance - Could not connect to the endpoint URL: "https://ec2.us-west-2a.amazonaws.com/"

I have created AWS EC2 Windows 16 instance and was able to attach additional volume etc...and so far so good.
I wanted to try to use CLI commands.
Installed CLI on AWS-EC2 windows instance. and did according the instructions attached in the picture below.
when I type "aws ec2 describe-instances I get "Could not connect to the endpoint URL"
When I was creating the instance, I chose a "Security Group" that had HTTPS enabled.
any help?
You probably have something wrong in your default profile for the default region.
Check your file at ~/.aws/config (or C:\Users\USERNAME \.aws\config for windows users), you have something like
[default]
region=us-west-2a
...
Fix the region to region=us-west-2 and then the command will work correctly
You can review the AWS page to make sure you have a valid endpoint http://docs.aws.amazon.com/general/latest/gr/rande.html, they are classified by AWS services

Deploy Application to AWS EC2 Instance using terraform

I need to deploy my Java application to AWS EC2 Instance using terraform. The catch here, we should not use *.pem file to deploy the application.
I try to create ELB and associate instances using terraform.I can able to deploy the application using ssh and pem file to ec2 instances Private IPs. But we shouldn't use *.pem or *.ppk file, as it'll not be allowed in production servers.
I tried using chef with terraform , but that also requires *.pem to connect to AWS Instances.
Please let me know the detailed steps/suggestions of how to deploy the application using terraform without using pem file.
If you can't make any changes to your instance after creating it (including deploying the application) then you will need to bake any and all changes into the AMI that Terraform deploys.
You might want to look into using Packer to create AMIs with your intended configuration and then use Terraform to deploy these AMIs.
For reference, this strategy is known as "immutable infrastructure" so you might want to do some further reading into this area.
If instead it's simply that SSH connectivity is not allowed and you can make changes over other ports then you should be able to use an AMI that has a Chef client, Puppet agent or Salt minion on it (there may well be other tools that work over a non SSH protocol/port but this restriction rules out Ansible) and then use any of those tools to continue to configure your instance. Obviously you could find a suitable AMI from the AMI marketplace or, once again, use Packer to set up the relevant configuration management client.

EC2 instance image on VirtualBOX?

Is there any way of getting the saved EC2 instance image and running it on virtualbox on my personal computer?
The official way is only if it was originally imported into EC2
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ExportingEC2Instances.html
If you have previously imported an instance into Amazon EC2, you can
use the command line tools to export that instance to Citrix Xen,
Microsoft Hyper-V, or VMware vSphere. Exporting an instance can be
useful when you want to deploy a copy of your EC2 instance in your
on-site virtualization environment.
You cannot export an instance unless it was previously imported into AWS
it looks like you can directly import/export ec2 and virtualbox/vmware images.
http://aws.amazon.com/ec2/vmimport/
The amazon tool is very restrictive. But you can dump your EBS, download it and make a VDI image out of it. I have done it with two of my EC2 instances and described the steps on my blog.
http://diogomelo.net/blog/16/export-amazon-ec2-instance-to-virtualbox

Resources