Skip to main content

Posts

Showing posts from May, 2021

No bootable medium found error VirtualBox

Migrating from physical to virtual or P2V is a common thing to do. In this virtualization era. If hardware or a server is showing some issues, like rebooting by itself when no changes are made and the server is at the age of a primary 3 kid. Then this could be that the server is showing some signs that it needs to be retired. P2V is a good option if an existing powerful server that is not fully utilized and is able to handle another load. Migrating from OpenStack or exporting OpenStack VM to a volume so it can be used outside of OpenStack is another practice also. But sometimes things don’t go smoothly and few bumps or issues here and there may arise at times. For example doing P2V in VirtualBox for a Linux system shows an error, “FATAL: No bootable medium found! System halted.” And you let the VM run for hours hoping that it will just boot by itself but it won’t just budge the error persist no matter how long you wait. P2V is migrating or cloning a physical server to a virtu

PowerShell Get Apache Tomcat application path

PowerShell code snippet to get the path of the Apache Tomcat folder. The PowerShell code snippet will get the Apache Tomcat folder based on the service path. So, if the Apache Tomcat is not installed on a specific folder or path. Code snippet below, will check where the folder is located. $varDirectory="" $apacheServiceName=((Get-WmiObject win32_service | ?{$_.Name -like '*tomcat*'} | select Name, State, PathName).Name) $apacheServicePath=((Get-WmiObject win32_service | ?{$_.Name -eq $apacheServiceName} | select Name, State, PathName).PathName) $apacheHome = $apacheServicePath.Substring(0, $apacheServicePath.IndexOf('\bin')) #set the folder path for the SSL cert #or set any path to teh Apache Home Folder $varDirectory = "$apacheHome\key\" #Check the Path if okay or not write-host $varDirectory #Force OverWrite and supress prompting #Copy files to the Apache Tomcat folder Copy-Item -Path "C:\Temp\star_007_com.jks" -Destination $varDirectory

Get EC2 Image used by the AWS Instance

PowerShell code snippet to get the image used by an specific instance. $accesskey = 'access-key' $secretkey = 'secret-key' $dregion =  'us-east-1' (Get-EC2Instance -AccessKey $accesskey -SecretKey $secretkey -Region $dregion -InstanceId i-055353ks53sd6n).Instances  | select ImageId | ft -HideTableHeaders | out-string  #i-055353ks53sd6n -- replace with the actual instance-id EC2 Image in AWS is quite important especially if you are deploying a fleet of AWS instances and it has to be in the same image.

Get Public and Private IP Address of an AWS instance

PowerShell code snippet below will get or display the Public and Private IP Address of all running instances that matches  the Tag Key and Value specified. #replace the access key, secret key and region with the actual value $accesskey = 'acces-key' $secretkey = 'secret-key' $dregion =  'us-east-1' #Display Public and Private IP Address of the Instance (Get-EC2Instance -AccessKey $accesskey -SecretKey $secretkey -Region $dregion) | Select -ExpandProperty RunningInstance | ? {$_.Tag.Key -eq "Server" -and $_.Tag.Value -eq "Web-Server"} | Select-Object PrivateIpAddress, PublicIpAddress  #Replace the Tag Key and Tag Value as required #$_.Tag.Key -eq "Server"   #$_.Tag.Value -eq "Web-Server"

AWS PowerShell check if tag exist

How to check if a Tag exist on an instance? How to change the value of the tag, if tag exist? Code below shows how to check tags on AWS instances using PowerShell.   The script will also check if the tag exists and change the value to a different value. Sample scenario where the script can be used: Example: the tag can be "Web_Server", Value "In Progress" Then once the instance is ready, the tag can be changed to "Web_Server", Value "Online"   $accesskey = 'AWS-Access-Key' $secretkey = 'AWS-Secret-Key' $dregion =   'eu-west-1' #change the region as required   #instances to be checked #repace the value with the actual instance-id $array_prefix_instanceID = @( "i-04e5er7ac566vc8", "i-0c3c3cerbc3165685vc", "i-0ecc355gf0aa5758g" )   #Assume value of the tag #Change as required / script will look for the value Yes $value="Yes"   #Tag to look