The Covenant of Primus is collectors’ collectible items for Transformers fans. The book is house in the Autobot insignia or shield. What is amazing, even the book casing is meticulously stored in a well package cardboard. designed to prevent damage to the cover that is housing the book case.
Continue readingHow to custom install AWSCli into linux based machine
Quote
Good new for AWS users, Amazon has release the new unified AWSCli was released in September 2013. Amazon did provide multiple ways to have the new AWSCli installed.
I have to admit the task of installation is more straight forward and simplified compared to the old AWS Cli.
At the time of this post, the AWSCli released version 1.2.6, and it runs on Python 2.6. Hence, this post will provide custom install of AWSCli into linux based machine.
For users who are planning to use the AWSCli bundle provided by Amazon here is the recommended steps in sequence. Disclaimer and note : I have not added any form of error catching or linux distro detection and I am assuming the linux distro used is redhat.
Installing AWSCli using the Amazon awscli-bundle
mkdir -p /opt/apps/tmp cd /opt/apps/tmp wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip unzip awscli-bundle.zip mkdir -p /opt/apps/$(ls awscli-bundle/packages/ | egrep -o 'awscli-[0-9]\.[0-9]\.[0-9]') ./awscli-bundle/install -i /opt/apps/$(ls awscli-bundle/packages/ | egrep -o 'awscli-[0-9]\.[0-9]\.[0-9]') /opt/apps/awscli/bin/aws --version ln -s /opt/apps/$(ls awscli-bundle/packages/ | egrep -o 'awscli-[0-9]\.[0-9]\.[0-9]') /opt/apps/awscli ln -s /opt/apps/awscli/bin/aws /usr/bin/aws ln -s /opt/apps/awscli/bin/aws.cmd /usr/bin/aws.cmd cd ~ rm -Rf /opt/apps/tmp
Installing AWS via pip
python --version apt-get install python-pip yum install python-pip cd /opt/apps/ mkdir tmp cd tmp wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py python ez_setup.py python get-pip.py pip install awscli==1.2.6 aws help cd ~ rm -Rf /opt/apps/tmp
The advantage of AWSCli bundle over the pip method is, ease of install without need to get ez_setup and pip installed. Since the AWSCli bundle zip is hosted within Amazon Web Service network, it took me less than 1 seconds to download the 5MB AWSCli-bundle.zip file.
[root@ip-10-255-255-1 ~]# time wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip --2013-11-28 05:25:16-- https://s3.amazonaws.com/aws-cli/awscli-bundle.zip Resolving s3.amazonaws.com... 176.32.99.46 Connecting to s3.amazonaws.com|176.32.99.46|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 5139105 (4.9M) [application/zip] Saving to: `awscli-bundle.zip' 100%[================================================================================================================ ===================================================================================>] 5,139,105 16.0M/s in 0.3s 2013-11-28 05:25:17 (16.0 MB/s) - `awscli-bundle.zip' saved [5139105/5139105] real 0m0.611s user 0m0.096s sys 0m0.036s [root@ip-10-255-255-1 ~]# time wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip --2013-11-28 05:25:49-- https://s3.amazonaws.com/aws-cli/awscli-bundle.zip Resolving s3.amazonaws.com... 176.32.99.46 Connecting to s3.amazonaws.com|176.32.99.46|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 5139105 (4.9M) [application/zip] Saving to: `awscli-bundle.zip' 100%[================================================================================================================ ===================================================================================>] 5,139,105 19.6M/s in 0.2s 2013-11-28 05:25:49 (19.6 MB/s) - `awscli-bundle.zip' saved [5139105/5139105] real 0m0.338s user 0m0.076s sys 0m0.036s
The downside of using the awscli bundle installation is users need to upload the awscli-bundle.zip into personal version control servers/services (such as github) in order to have version control of awscli. Therefore, there will be overhead of maintaining the version of the awscli and it will be labor intensive or makes processes complicated.
The only disadvantage of pip AWSCli is the pre-requisite of installing pip. And maybe in the future, would be a permanent removal of older awscli version from the pip public repository.
Administrator using pip will be able to make awscli to be installed into a customed directory such as /opt/apps by using the following pip command
pip install --install-option="--prefix=/opt/apps" awscli==1.2.6
Unfortunately, in doing so pip will no longer able to manage the awscli package. Administrators will need to have a small effort to remove the installed version manually before upgrading the AWSCli using the similar command.
As a closing, to my personal opinion pip is a better way to install and maintaining the version of AWSCli.
Adding Amazon Web Service EC2 instances IP and names into PuTTY session automagically
Introduction :
The pre-requisite :
- Make sure that your EC2 API Tools are setup, with correct authentication keys. http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/InstallEC2CommandLineTools.html
- Make sure that you have installed AWS Tools for powershell http://aws.amazon.com/
powershell/ - Make sure your windows machine is using PowerShell version 2.0
- It is under assumption that you have created a tag called as “Name” in AWS EC2
- It is under assumption that you have name your instance in the “Name” field in the AWS EC2 using the format /[product_name]/[environment]/[sub-system]/[server-number] example : /render_farm/dev/engress-services/1
- Ensure that you are really a PuTTY user, else you can always download it from http://www.chiark.greenend.org.uk/~sgtatham/putty/
The idea :
Codes of generate_putty_session.bat :
@echo off
powershell -version 2.0 -ExecutionPolicy unrestricted %~dp0generate_putty_sessions.ps1
regedit.exe /s %userprofile%\putty_list.reg
Codes of generate_putty_session.ps1 :
#Preloading scripts
#Removing old reg file
if ( Test-Path $env:userprofile\putty_list.reg){
del $env:userprofile\putty_list.reg
}
#Check environment for Windows x86 or x86_64
if ([IntPtr]::Size -eq 4){
if ( Test-Path "C:\Program Files\AWS Tools\PowerShell\AWSPowerShell"){
import-module "C:\Program Files\AWS Tools\PowerShell\AWSPowerShell\AWSPowerShell.psd1"
}
else{
write-host "AWS Tools for PowerShell was not install, exiting. Download at http://aws.amazon.com/powershell/"
exit
}
}
else{
if ( Test-Path "C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell"){
import-module "C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell\AWSPowerShell.psd1"
}
else{
write-host "AWS Tools for PowerShell was not install, exiting. Download at http://aws.amazon.com/powershell/"
exit
}
}
#Check env variable for required EC2 configuration
if (-not (Test-Path Env:\EC2_HOME)){
write-host "Environment variable EC2_HOME was not found, please ensure your EC2 API Tools were properly installed or configured or setup."
exit
}
if (-not (Test-Path Env:\EC2_CERT)){
write-host "Environment variable EC2_CERT was not found, please ensure your EC2 API Tools were properly installed or configured or setup."
exit
}
if (-not (Test-Path Env:\EC2_PRIVATE_KEY)){
write-host "Environment variable EC2_PRIVATE_KEY was not found, please ensure your EC2 API Tools were properly installed or configured or setup."
exit
}
#Get my script path
$myPath = split-path -parent $MyInvocation.MyCommand.Definition
if(-not (Test-Path -path $myPath\reg_header.txt)){
write-host "Please make sure reg_header.txt is in " $myPath
exit
}
if(-not (Test-Path -path $myPath\reg_putty.txt)){
write-host "Please make sure reg_header.txt is in " $myPath
exit
}
Copy-Item $myPath\reg_header.txt $env:userprofile
Copy-Item $myPath\reg_putty.txt $env:userprofile
#Main body and function of the script.
#Creating file to link instance ID with Public DNS
ec2-describe-instances --filter `"virtualization-type=paravirtual`" --filter `"instance-state-name=running`" --filter `"tag:Name=/*/*`" | Select-String -pattern INSTANCE -caseSensitive | foreach { "$($_.ToString().split()[1,3])" >> $env:userprofile\awsinstanceIP.tmp}
#Creating a file to link instance ID with Name tag
ec2-describe-instances --filter `"virtualization-type=paravirtual`" --filter `"instance-state-name=running`" --filter `"tag:Name=/*/*`" | Select-String -pattern Name -caseSensitive | foreach { "$($_.ToString().split()[2,4])" >> $env:userprofile\awsinstanceName.tmp}
# Clean up results, removing RenderWorkerGroup
Get-Content $env:userprofile\awsinstanceName.tmp | Select-String -pattern RenderWorkerGroup -NotMatch | foreach { "$($_.ToString().split()[0,1])" >> $env:userprofile\awsinstanceNameClean.tmp}
#$awsInstanceIDIP = Get-Content $env:userprofile\awsinstanceIP.tmp
$awsInstanceCleanName = Get-Content $env:userprofile\awsinstanceNameClean.tmp
$count = 0
# Create HashTable from File.
ForEach ($line in $awsInstanceCleanName) {
if ($count -le 0 ) {
$myHash = @{ $line.ToString().Split()[0] = $line.ToString().Split()[1]}
}
else{
$myHash.Set_Item($line.ToString().Split()[0], $line.ToString().Split()[1])
}
$count = $count + 1
}
$count = 0
Get-Content $env:userprofile\awsinstanceIP.tmp | ForEach-Object {
$line = $_
$myHash.GetEnumerator() | ForEach-Object {
if ($line -match $_.Key)
{
if ($_.value.ToString().Contains("render-worker")){
$replacement = $_.Key.ToString() + " " + $_.Value.ToString() + "/" + $_.Key.ToString()
}
else{
$replacement = $_.Key.ToString() + " " + $_.Value.ToString()
}
$line = $line -replace $_.Key, $replacement
}
}
$line
} | Set-Content -Path $env:userprofile\awsinstanceResult.tmp
del $env:userprofile\awsinstanceIP.tmp
del $env:userprofile\awsinstanceName.tmp
del $env:userprofile\awsinstanceNameClean.tmp
$awsinstanceResult = Get-Content $env:userprofile\awsinstanceResult.tmp
#Adding header into file content.
Add-Content $env:userprofile\awsinstanceReg_List.tmp $(Get-Content $env:userprofile\reg_header.txt)
Add-Content $env:userprofile\awsinstanceReg_List.tmp "`r"
# Populating body of the file before converting into registry file.
foreach ($line in $awsinstanceResult){
$reg_line = "`[HKEY_CURRENT_USER\Software\Simontatham\PuTTY\Sessions\" + $line.ToString().Split()[1] + "]"
Add-Content $env:userprofile\awsinstanceReg_List.tmp $reg_line
$reg_line = "`"HostName`"=`"" + $line.ToString().Split()[2] + "`""
Add-Content $env:userprofile\awsinstanceReg_List.tmp $reg_line
# Add fillers to the sessions
Add-Content $env:userprofile\awsinstanceReg_List.tmp $(Get-Content $env:userprofile\reg_putty.txt)
Add-Content $env:userprofile\awsinstanceReg_List.tmp "`r"
}
Get-Content $env:userprofile\awsinstanceReg_List.tmp | Add-Content $env:userprofile\putty_list.reg
#Removing all temporary files
del $env:userprofile\awsinstanceReg_List.tmp
del $env:userprofile\awsinstanceResult.tmp
del $env:userprofile\reg_header.txt
del $env:userprofile\reg_putty.txt
Using the script :
Code Download :
Movie accurate Leader Class ROTF Optimus Prime using FWI-3
FWI-3 or FWI-03 , Fans Wants It number 3 is the unofficial add on of Jetfire parts to create the accurate renditon of Jet Power Up Optimus Prime in the last battle scene of the movie Revenge of the Fallen.
To the date of this post, the FWI-3 makes the Leader Class Optimus Prime true to its movie rendition without need much work or customizing the original Leader Class Optimus Prime of ROTF.
The FWI-3 comes in a big Continue reading
How to fix Transformers GO! G02 Jinbu knee
Hell break loose when Takara Tomy announced to recall Ginbu from the Transformers GO! series toy line. Consumer in Japan has the privilege to get the fix from Japanese retailer. For the rest of Jinbu owner in the rest of the world, need to do the good old DIY. For the original news of the recall :
- http://www.seibertron.com/transformers/news/takara-tomy-recall-for-transformers-go-g02-jinbu/27698/
- http://www.tfw2005.com/transformers-news/japanese-transformers-40/transformers-go-jinbu-recall-and-replacement-piece-177855/
- http://www.fullmetalhero.com/content/takaratomy-recalling-transformers-go-jinbu-7051/
Unfortunately, the Transformers GO! G02 Jinbu that I owned faced the problem.
To fix the assembly flaw, I had taken Continue reading
Good general purpose point and shoot camera
The subject used for my photography is the environment and macro. My previous camera had served me well, the olympus SP570uz.
The successor camera I have choses is the Panasonic lumix LX7.
The reasons were simple better digital sensor 1/1.17″ cmos sensor compared to 1/2.23″ DVD sensor. Default focal length of 24mm over 28mm. Biggest aperture F1.4 compared to F2.8 .
With such spec, the lumix LX7 offers better control for depth of view to create bokeh effect.
Stay tuned for sample shots from the Panasonic Lumix LX7.
Using MSG to make Transformers awesome
Kotobukiya M.S.G Weapon unit 6; samurai sword and machete
M.S.G weapon unit 6 would make your figure more awesome.
The katana is 10cm in length, machete is about 8cm in length. Originally designed to complement the Frame Arms of the Kotobukiya plastic model line or 1/144 scale plastics model. It could be used for voyager class Transformers; on caveat that some modification to the katana and machete pommels.
Continue reading
How to deploy Microsoft Azure using PowerShell
Pre-requisite :
- Windows XP or more later version of Windows OS.
- Powershell 2.0 installed
- PowerShell for Azure installed
- Azure Project compiled and packaged
Steps : Continue reading
A great outing at Monkey Beach with my dearest
Penang, known in the past as Pearl of the Orient. But for the past 10 years it has been known it has pretty congested traffic during peak hours of work. Luckily, the saving grace is, Penang still has some of its natural environment intact.
Continue reading













