Showing posts with label Amazon. Show all posts
Showing posts with label Amazon. Show all posts

Thursday, April 30, 2009

Create Image from existing instance and reuse to create a new instance

Often we need to create one production instance and another test instance for testing. Environment is similar for both instances. So if you are using Amazon ec2 then you can configure one instance and then create an image from that instance to reuse it to create another instance just like the first one.

Create volume from your instance

Copy pk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pem and cert-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pem file into /mnt folder in your instance.

Note: You can download these files from your amazon account.

/mnt is not included in the image so your certification files will be secured and not stored in the image.

login to your instance and run in command line,

ec2-bundle-vol -d /mnt -k /mnt/pk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pem -c /mnt/cert-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pem -u xxxxxxxxxxxx -r i386 -s 1536
Here,
–d => is the directory where the images will be generated
-k => privatekey PATH
-c => cert PATH
-u => your AWS account ID as your username (not your AWS Access Key ID)
-r => Specify target architecture. [i386, x86_64]
-s => The size, in MB (1024 * 1024 bytes), of the image file to create. The maximum size is 10240 MB
upload bundle into your s3 bucket

Then run,

ec2-upload-bundle -b 'your-s3-bucket' -m /mnt/image.manifest.xml -a 'aws-access-key-id' -s 'aws-secret-access-key' 
Register image

run

ec2-register 'your-s3-bucket'/image.manifest.xml

You should see some thing like this in the screen.

IMAGE   ami-xxxxxxxx

Note: You might not get this command from instance. For this you will need ec2 api tool in you instance or in your local machine.

You can download it from here.

Running Instances from your newly created image

run

ec2-run-instances ami-xxxxxxxx

You should see some thing like this in the screen.

RESERVATION     r-632db90a      106811649921    default
INSTANCE        i-xxxxxxxx      ami-xxxxxxxx                    pending
0               m1.small        2009-04-30T05:26:38+0000        us-east-1c

resources

http://docs.amazonwebservices.com/AmazonEC2/gsg/2006-06-26/creating-an-image.html

http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351

http://wiki.apache.org/hadoop/AmazonEC2[For publishing Image as public]

Tuesday, November 25, 2008

Amazon Flexible Payments Service

Key features include

  • Send and receive money using credit card, bank account or Amazon Payments balance transfer as payment methods.
  • Create “Payment Instructions” to define conditions and constraints desired for a given transaction, and programmatically obtain payment authorizations or “tokens” that represent these Payment Instructions from customers.
  • Execute one-time, multiple, or recurring payments on behalf of customers.
  • Aggregate micro-transactions into a single larger transaction using Prepaid and Postpaid capabilities.
  • Integrate Amazon FPS into your website in minutes with Amazon Simple Pay, a set of copy-and-paste HTML buttons.
  • Build payment applications where you are neither the sender nor the recipient of funds. You can build marketplace applications that enable the movement of money between two third parties. Try Amazon Simple Pay Marketplace.
  • View account balances, transaction histories, and transaction details on the Amazon Payments web site.
  • Utilize the Amazon FPS sandbox to build and test applications without using real money or incurring any transaction charges.

References

General Process

  1. Generate a caller token(Needed once for each application)
  2. Generate a recipient token
  3. Generate a co-branded UI url with caller and recipient token
  4. Redirect to Amazon with a generated co-branded UI url
  5. Amazon will redirect to your web site with a sender token
  6. Execute Payment using caller, recipient and sender token

Sample Source Code and API can be found here

Plugins

There are 2 plugins amazon_fps_foo and remit. I could not find much documentation for amazon_fps_foo.

Remit

Remit uses a REST implementation of Amazon Flexible Payments Service (FPS).

There is an example for a "simple" implementation of a "marketplace" charge (one in which you are charging a client for a
product on behalf of another party): http://gist.github.com/46941

Testing

You can check your code with out flowing real money. Sandbox is the test server for checking your code regarding FPS.

Developer Resources

Additional Product Information