RSS

Tag Archives: Amazon-EC2

How to create subaccounts and share buckets using IAM and CloudBerry S3 Explorer

Note: this post applies to CloudBerry Explorer 2.4.2 and later.
As always we are trying to stay on top of the new functionality offered by Amazon S3 to offer the most compelling Amazon S3 and CloudFront client on Windows platform.
A few weeks ago Amazon introduced Identity and Authentication Management (IAM) Service. It is a new exciting service that allows creating user accounts inside the master account and grant those account a set of permissions. CloudBerry Explorer PRO 2.4 already comes with full support for IAM service and you can learn more about that in our previous blog post.
In this blog post we will look into the very common scenario of creating a subaccount within the master account and granting it permissions to a creation bucket. This might be useful if you for instance work with freelancers and want them to be able to work with the content in their own bucket.

Creating a policy

Click Access Manager in the main menu to run IAM management tool from within CloudBerry Explorer.
image001

In the Access Manager click New User to open up a dialog. Name the user and click ok.
image003
The new user should show up on the list. Right click it and click Add Policy…
image005
Click New Statement and then <select actions> to choose the list of actions that your new users will be allowed to do. You can see below those the most common ones.
Click in: to specify the bucket name and the path. Make sure to add “/*” to the path to propagate the policy to the bucket content.
Click New Statement once again this time for the bucket itself. Choose S3:ListBucket for action and make sure that you don’t add “/*” at the end. This is because you are applying the statement to a bucket not to its contents.
You can optionally set a condition. In our example it is valid only till Nov, 1 2010. After that time the user will not have access to the resource.
Click Ok to create the policy.
Designer
Last but not least, you have to generate an access/ secret key pair for your new user. Click Generate Access Keys… in the user context menu. Copy the keys so that you can hand them over to the user later.
image009

Working as a User

Register an account for the newly created user in CloudBerry Explorer console. Use assess/ secret key created earlier.
Note: you can use CloudBerry Explorer freeware to register one bucket for IAM user. If you need to register more than one bucket you will have to turn to our pro version.
image011
Now, select the newly created account in the drop down list. If you look at the list of buckets it will be empty. This is because we have not granted the user a right to list all buckets. You have to add a bucket as an external bucket manually. Click a green button on the tool bar and type the bucket name manually.
image013
Now you can see the bucket in the console. You can copy, move, delete files, create folders, etc.
image015
As always we would be happy to hear your feedback and you are welcome to post a comment.

CloudBerry S3 Explorer is a Windows freeware product that helps managing Amazon S3 storage and CloudFront . You can download it at http://cloudberrylab.com/

CloudBerry S3 Explorer PRO is a Windows program that helps managing Amazon S3 storage and CloudFront . You can download it at http://pro.cloudberrylab.com/ It is priced at $39.99

Like our products? Please help us spread the word about them. Learn here how to do it.
Want to get CloudBerry Explorer PRO for FREE? Make a blog post about us!

 
 

Tags: , , , , , ,

Backup mysql database to amazon S3

Below is the simple code to create sql script of database on Amazon EC2 server using “mysqldump”…

then upload this sql script to Amazon S3 bucket using command line S3 tool “s3cmd”…

<?php

$sqlbackup=”/usr/bin/mysqldump -v -u root -h localhost -r /var/www/html/backup/”.date(“Y-m-d-H-i-s”).”_db.sql -pdbusername  databasename 2>&1″;

exec($sqlbackup, $o);
echo implode(“<br /> “, $o);

$file = “/var/www/html/backup/”.date(“Y-m-d-H-i-s”).”_db.sql”;
$bucket = “s3bucketname”;

exec(“/usr/bin/s3cmd  put –acl-public –guess-mime-type  –config=/var/www/html/.s3cfg   “.$file.”  s3://”.$bucket.”  2>&1″, $o);

echo implode(“<br /> “, $o);

?>


Lunarpages.com Web Hosting

 

Tags: , , , , , , , , , , , , , ,

Amazon EBS

Amazon Elastic Block Storage (EBS)

We can use Amazon EBS just like as the CD/DVD/Pen Drives on our PC/Laptops Servers for backup or data transfer…
EBS can attach to an EC2 instance, we can use EBS to save work files in it.. for it we have to mount it in the instance after backup we can unmount it, and detach it.
We can use the volume afterward by mounting it in another instance but different instances at the same time can not use same EBS volume.

Starting an Instance

# ec2-describe-images -o self -o amazon | grep machine
# ec2-add-keypair gsg-keypair (save this keypair for connecting instance via SSH)
# chmod 600 id_rsa-gsg-keypair ; ls -l id_rsa-gsg-keypair
# ec2-run-instances ami-235fba4a -k gsg-keypair
# ec2-describe-instances i-ae0bf0c7

Authorize ports to connect remotely…
# ec2-authorize default -p 22
# ec2-authorize default -p 80

Connect to instance
# ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com

Create the Volume
# ec2-create-volume –size 1 -z us-east-1c
Create this volume in same availability zone

# ec2-describe-volumes vol-4771e479

Attaching the Volume
# ec2-attach-volume vol-4771e479 -i i-ae0bf0c7 -d /dev/sda

Formatting the Volume
# ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com
# ls /dev
# yes | mkfs -t ext3 /dev/sda

Mounting the Volume
# mkdir /mnt/svnlabs-data
# mount /dev/sdh /mnt/svnlabs-data

Put a file on the volume
# vi /mnt/svnlabs-data/svnlabs.txt (put content here)

Unmounting the Volume
# cd ~
# umount /mnt/svnlabs-data

Detach the Volume
# ec2-detach-volume vol-4771e479 -i i-ae0bf0c7 -d /dev/sda

As we attach this volume to other instance we will get our svnlabs-data folder to new instance…

svnlabs will post some new articles on “Amazon Web Services” 😉 subscribe to svnlabs feeds

 
 

Tags: , , , , , , , , , , , , , , , ,

Configure Amazon EC2

1.Boot 2 linux servers on EC2
2.Assign elastic IP to each of them
3.Register a domain (eg svnlabs.com)
4.On the domain settings – create 2 host records – ns1.svnlabs.com and ns2.svnlabs.com and point each record to each of the elastic IPs.
5.On your 2 nameserver instances – create dns zone for ns1. and ns2 respectively
6.Make ns2 a slave of ns1 – you can if you wish add ns3… ns4.. etc etc but its not necessary unless your site is getting millions of users.
7.Boot another EC instance and install the Scalr application.
8.Create a user on ns1. called “named” that has permissions to update the dns zone records on ns1.
9.The DNS settings of the scalr application will refer to the nameservers ns1. with user “named” and password as set on ns1.
10.Your application for example will have the domain svnlabs.com.  Register this domain and set its nameservers to your ns1. and ns2 mentioned previously.
11.You need to first create a new zone file on ns1 for svnlabs.com
12.In Scalr when asked for the application domain name – simply enter svnlabs.com – and scalr will handle the rest.

****************************************************************

You will need to register a domain name with a domain registrar.  After registering, you will need to enter your NS records for the domain name.  The NS records should point to a Domain Name Server (DNS).  Most registrars require at least two DNS servers to eliminate a single point of failure.

Some registrars provide free DNS services.  If you choose such a registrar, you would need to add a CNAME record for your sub-domain and ask any DNS application support related questions to your registrar.

Alternatively, you can launch and configure your own DNS servers on Amazon EC2.  A popular choice for Linux based DNS servers is BIND: http://en.wikipedia.org/wiki/BIND

Another option is to outsource your DNS servers using a third-party provider, for example http://www.dyndns.com/.

http://groups.google.com/group/scalr-discuss/web/how-to-host-your-mx-on-google

Cost: http://bhopu.com/Tags/Amazon-EC2

 

Tags: , , , , ,