Stop multiple untagged AWS EC2 instances with a Bash script

 List all EC2 instances without a specific tag One day we have found 499 instances running in our account without any tags. Most likely someone accidentally started a process to launch those, so we needed a way to find them and stop them. Later we will terminate them with the same script below when we can make […]

Creating CentOS server images with Packer

The CentOS images are not available on the AWS Quick Start tab. CentOS publishes official images on the AWS Marketplace, but you need to subscribe to the image to be able to launch it with an automation software, like Terraform. Find the latest available CentOS image in the AWS Marketplace Execute this command to display the […]

SocketError: Error connecting to … Name or service not known

In an enterprise environment, the company usually operates its own DNS servers. When a Linux instance launches in AWS, the DNS settings only contain the AWS DNS server. If the company DNS server settings are applied with Chef, during the first Chef Client run those settings do not take effect. When we reference an internal DNS […]

“Ran out of time waiting for the server with id” with Windows Server 2016 in Chef Test Kitchen

AWS changed how Windows Server EC2 instances send messages during boot. Windows Server 2012 R2 AWS EC2 instances sent the “Windows is ready” message every time those became available after boot. When a Windows Server 2016 AWS EC2 instance launches, it only sends the “Windows is ready” message during the first boot. If you create your custom […]

Open the system drive of an AWS instance you cannot log into

If you cannot log into an AWS instance and want to inspect files on it, you can detach the volume from the lost instance and attach it to another instance as the secondary drive. Create a new instance Create a new AWS instance and log into it, Make a note of the Instance ID of […]

Create a new server image for a RightScale server template

The RightScale server templates publish server images to launch. It is advisable to create your own server image because the cloud providers can remove their published images anytime. If you generate your own image, you control the lifecycle of those. Create your own server image Use Packer to create a new server image. Install RightLink. On […]

amazon-ebs: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

When you launch a Linux AWS EC2 instance with Terraform or create a Linux AWS image with Packer, one of the following errors are displayed: amazon-ebs: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain aws_instance.default: 1 error(s) occurred: * ssh: handshake failed: ssh: unable to […]

The instance ID ‘…’ does not exist

When you launch an EC2 instance in AWS and the Chef script is trying to set tags on the instance you may get the error message: The instance ID ‘…’ does not exist It can happen when you launch the instance in one AWS account, and the tagging script tries to find the instance in another […]