Custom Search

Sunday, June 23, 2013

How to use Amazon S3 tool s3cmd

* S3cmd is a command line (CLI) tool for uploading, retrieving and managing data in Amazon S3.

1)
Install s3cmd

#apt-get install s3cmd

2)
Check Version

#s3cmd --version
s3cmd version 1.0.0
* In "s3cmd version 1.0", we need to add 'access' and 'secret access' keys in a file and pass name of that file as argument.
* "s3cmd version 1.5 alpha" has option to pass 'access' and 'secret access' keys as argument.


3)
Create a config file "myconf.txt" and add 'access' and 'secret access' keys in it.

http://docs.basho.com/riakcs/latest/cookbooks/configuration/Configuring-an-S3-Client/
#vim myconf.txt
access_key = xxxxxxxxxxxxxxxxxx
secret_key = xxxxxxxxxxxxxxxxxxx


4)
List buckets in the default region

#s3cmd -c myconf.txt ls

5)
How to switch region

http://sourceforge.net/p/s3tools/discussion/618865/thread/b3673c09
http://s3tools.org/s3cmd-100rc1-released

* Add following lines into "myconf.txt" to connect to "us-west-1" region.
#vim myconf.txt
host_base = s3-us-west-1.amazonaws.com
host_bucket = %(bucket)s.s3-us-west-1.amazonaws.com


6)
List buckets in the "us-west-1" region

#s3cmd -c myconf.txt ls

7)
How to download the file "alchemy_proj.tar.gz" from the bucket "import-export" in the "us-west-1" region


a)
Prepare config file
#vim myconf.txt
access_key = xxxxxxxxxxxxxxxxxx
secret_key = xxxxxxxxxxxxxxxxxxx
host_base = s3-us-west-1.amazonaws.com
host_bucket = %(bucket)s.s3-us-west-1.amazonaws.com


b)
Command to download file "alchemy_proj.tar.gz" from S3 to local system

#s3cmd -c myconf.txt get s3://import-export/alchemy_proj.tar.gz .
or
#s3cmd -c myconf.txt get s3://import-export/alchemy_proj.tar.gz dest_dir_path

Saturday, June 22, 2013

Thursday, June 20, 2013

How to download file from Amazon S3 to local system using ec2-download-bundle

1)
Export Aws Access and Secret keys
 
#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

2)
Download the file "export-i-ffm3g49z.ova" from S3 to to Local System
#ec2-download-bundle -b import-export -m export-i-ffm3g49z.ova -a $AWS_ACCESS_KEY -s $AWS_SECRET_KEY -k pk-XXXXXXUPPXXXXXXXXXXX.pem -d local_system_down_dir

Note:
* Download "Primary_key" from your Amazon web console.
http://fosshelp.blogspot.in/2013/06/amazon-howto-download-x509-certificate.html

Django How to create json fixture from database table

1) Help
#python manage.py dumpdata --help

2) Create json fixture from table Template
#python manage.py dumpdata dbtemplates.Template  > ~/Desktop/template.json

Wednesday, June 19, 2013

Amazon How to describe and cancel export tasks

Amazon How to describe and cancel export tasks using ec2-api-tools

1)
Export Aws Access and Secret keys

#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

2)
Export EC2 Instance i-54a45a0f

#ec2-create-instance-export-task i-54a45a0f -e VMware -f VMDK -c ova -b import-export -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

3)
Optional

Error:
-----
Client.AuthFailure: vm-import-export@amazon.com must have WRITE and READ_ACL permission on the S3 bucket.

Fix:
----
Goto bucket "import-export" --> Properties --> Permissions --> Add More Permissions --> Grantee [vm-import-export@amazon.com], List[ok], Upload/Delete[ok], View Permissions[ok] --> save

4)
Describe Export Task

#ec2-describe-export-tasks -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

5)
Cancel Export Task

#ec2-cancel-export-task export-i-ffm3g49z -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

How to Import XEN Virtual Machine to Amazon EC2

How to Import XEN Virtual Machine to Amazon EC2

1)
Install ec2-api-tools_1.6
#wget http://launchpadlibrarian.net/111617788/ec2-api-tools_1.6.1.1-0ubuntu1_all.deb
#sudo dpkg -i ec2-api-tools_1.6.1.1-0ubuntu1_all.deb

2)
Check the Version of ec2-api-tools
#ec2-version
3)
Export Aws Access and Secret keys
#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

4)
Create EC2 Instance using RAW Disk
#ec2-import-instance win2k-r2-disk1.xm -f RAW -t m1.small -a x86_64 -b import-export -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

5)
Check the Progress of the task
#ec2-describe-conversion-tasks import-i-ffm2nty0 -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

6)
Resume task
#ec2-resume-import win2k-r2-disk1.xm -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

7)
Remove the image from S3, when the task completed
#ec2-delete-disk-image -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

How to Import KVM Virtual Machine to Amazon EC2

How to Import KVM Virtual Machine to Amazon EC2

1)
Install ec2-api-tools_1.6
#wget http://launchpadlibrarian.net/111617788/ec2-api-tools_1.6.1.1-0ubuntu1_all.deb
#sudo dpkg -i ec2-api-tools_1.6.1.1-0ubuntu1_all.deb

2)
Check the Version of ec2-api-tools
#ec2-version
 3)
Export Aws Access and Secret keys
#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

4)
Create EC2 Instance using RAW Disk
#ec2-import-instance win2k-r2-disk1.xm -f RAW -t m1.small -a x86_64 -b import-export -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1 -g my_sec_group

5)
Check the Progress of the task
#ec2-describe-conversion-tasks import-i-ffm2nty0 -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

6)
Resume task
#ec2-resume-import win2k-r2-disk1.xm -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

7)
Remove the image from S3, when the task completed
#ec2-delete-disk-image -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

Tuesday, June 18, 2013

windows how to install vmware-vmrc

windows how to install vmware-vmrc

1)
Goto

https://github.com/vmware/rvc/downloads

2)
Download

https://github.com/downloads/vmware/rvc/vmware-vmrc-win32-x86-3.0.0-309851.xpi

3)
Rename

vmware-vmrc-win32-x86-3.0.0-309851.xpi
to
vmware-vmrc-win32-x86-3.0.0-309851.zip

4)
Extract

vmware-vmrc-win32-x86-3.0.0-309851.zip

5)
Edit Environment Variable

MyComputer --> Properties --> Advanced --> Environment Variables

Friday, June 14, 2013

Git setting up bare remote repository in VPN network

Git How to setting up bare remote repository in VPN network

1)
First setup the bare remote repository:
===============================

a)
ssh to remote system
#ssh root@192.168.12.164

b)
Create a new dir
#cd /root/projects/
#mkdir myproject.git

c)
Goto to new dir
#cd myproject.git

d)
Run git init
#git init --bare

e)
For serve via HTTP
#git update-server-info


2)
On local machine:
================

a)
Goto your project dir
#cd myproject

b)
Run git init
#git init

c)
Add all files to git
#git add *

d)
Commit
#git commit -m "My initial commit message"

e)
Add remote bare repo
#git remote add origin root@192.168.12.164:projects/myproject.git

f)
Push changes to remote bare repo
#git push -u origin master


3)
Clone from remote bare repository
============================
a)
Goto another system
#ssh root@192.168.12.154

b)
Clone
#git clone root@192.168.12.164:projects/myproject.git
#cd myproject

How to fix Client.ResourceLimitExceeded: Task failed to initialize - conversion task limit (5) exceeded

How to solve the issue Client.ResourceLimitExceeded: Task failed to initialize - conversion task limit (5) exceeded



Thursday, June 13, 2013

Amazon How to describe and cancel conversion tasks

1)
Export Aws Access and Secret keys

#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

2) 
Create Import instance task
#ec2-import-instance win2k-r2-disk1.vmdk -f VMDK -t m1.small -a x86_64 -b import-export -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1


3)
Describe Tasks

#ec2-describe-conversion-tasks -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

4)
Cancel Task
#ec2-cancel-conversion-task import-i-fh8kw7k3 -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

Tuesday, June 11, 2013

How to Import VMware Virtual Machine to Amazon EC2

How to Import VMware Virtual Machine to Amazon EC2

1)
Install ec2-api-tools_1.6
#wget http://launchpadlibrarian.net/111617788/ec2-api-tools_1.6.1.1-0ubuntu1_all.deb
#sudo dpkg -i ec2-api-tools_1.6.1.1-0ubuntu1_all.deb

2)
Check the Version of ec2-api-tools
#ec2-version


3)
Download Vitual Machine from ESXi node in ovf format
#ovftool vi://root:welcome@192.168.12.154/win2k-r2 win2k-r2.ovf

4)
Export Aws Access and Secret keys
#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

5)
Create EC2 Instance using *.vmdk
#ec2-import-instance win2k-r2-disk1.vmdk -f VMDK -t m1.small -a x86_64 -b import-export -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

6)
Check the Progress of the task
#ec2-describe-conversion-tasks import-i-ffm2nty0 -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1


7)
Resume task
#ec2-resume-import win2k-r2-disk1.vmdk -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

8)
Remove the image from S3, when the task completed
#ec2-delete-disk-image -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

Monday, June 10, 2013

Amazon Howto download X.509 Certificate and Private Key

Amazon Howto download X.509 Certificate and  Private Key

1)
Goto
https://console.aws.amazon.com/iam/home?#security_credential

Friday, June 7, 2013

How to use ovftool command line utility

How to use ovftool command line utility

1)
To see all VMs in the ESXi Server 192.168.1.26
#ovftool vi://192.168.1.26

2)
To get the ovf of VM demovm1
#ovftool vi://192.168.1.26/demovm1 ~/Desktop/ovfs/
#ovftool vi://root:xxxxxx@192.168.1.26/demovm1 ~/Desktop/ovfs/



3)
To get the ovf of VM vcenter2, poweroff VM before taking ovf
#ovftool --powerOffSource vi://root:xxxxxx@192.168.1.26/vcenter2 ~/Desktop/ovfs/

4)
To get the ovf of VM using moref "238"
#ovftool vi://root:xxxxxx@192.168.1.26?moref=vim.VirtualMachine:238 ~/Desktop/ovfs/

5)
Download ovf file with progress tracking (Working)
#ovftool --machineOutput vi://root:xxxxxx@192.168.1.26?moref=vim.VirtualMachine:238 ~/Desktop/ovfs/

6)
Convert an OVF to a VMX
#ovftool -tt=vmx a2.ovf ~/Desktop/
#ovftool vm1.ovf ~/Desktop/vm2.vmx

7)
Create a new VM "p1" on ESXI node 192.168.1.26 using *.vmx file
#ovftool -ds=datastore2 -n=p1 demovm2.vmx vi://root:xxxxxx@192.168.1.26/
-ds --> Datastore
-n --> Name of new VM

8)
Create a new VM "k1" on ESXI node 192.168.1.126 using *.ovf file
#ovftool -ds=datastore2 -n=p2 demovm2.ovf vi://root:xxxxxx@192.168.1.26/

9)
Convert a VMX to an OVF
#ovftool -tt=ovf a2.vmx ~/Desktop/
#ovftool -tt=ovf demovm2.vmx .

10)
Convert a VMX to an OVA
#ovftool -tt=ova a2.vmx ~/Desktop/
#ovftool -tt=ova demovm2.vmx .

11)
How to convert ova to ovf to vmx
a)
ova to ovf
#ovftool -tt=ovf xvm1.ova .

b)
ova to vmx
#ovftool -tt=vmx xvm1.ova .