Monday, November 19, 2012

[PHP/MySQL] Amazon EC2, Elastic Beanstalk, RDS setup

Basic setup of using these three services in.....haaaarrrmony. I'm using WinXP.

Index:
1. Setup EC2 instance
2. Setup Elastic Beanstalk with GIT (Tested with PHP projects)
3. Setup RDS to be used with MySQL Workbench

1. EC2 Instance
   Just follow the instructions and CREATE and DOWNLOAD your key/pair. Creating your instance is the only time you can assign a key/pair to it, let alone download it. Take note of the security group you are using for it. Also, go find your internet IP and add it to the selected security group.

2. Elastic Beanstalk
   This is basically your web host that you deploy to. Download GIT and the CLI Package (http://aws.amazon.com/code/6752709412171743). Find GIT on Google and the CLI Package in the Elastic Beanstalk documentation. Install GIT and run the CLI Package according to the instructions in the archive. 

Configuring Beanstalk for file uploading/deploying:
Go to your working folder in command line.
First, type eb init
Follow the instructions and you can find the your credentials here: https://aws-portal.amazon.com/gp/aws/securityCredentials
After you're done, enter the command: eb start

Now, you should be able to run git commands. Usually, this is the sequence I use:
1. git add .    (adds all files/folders/sub-folders)
2. git commit -m "<your message>"
3. git aws.push

3. RDS
1. Choose/create a database instance you would like to work with.
2. Go to the DB Security Groups section.
3. Add a new connection type of EC2 Security Group and choose the same one used in your EC2 Instance. You may also want to add a new CIDR/IP address using an IP finder.
-- MySQL Workbench
4. Setup a New Server Instance
5. Select Remote Host and input the address of your EC2 instance.
6. Select SSH type of connection
7. For SSH user, put ec2-user if using Amazon or ubuntu if using Linux
8. SSH password is not required.
9. Use the key/pair generated earlier
10. Enter the rest with the DB Instance info.

After all that, you should be good to go. Cheers



1 comment:

  1. Really like that you are providing such information on PHP MYSQl with JAVASCRIPT ,being enrolled at http://www.wiziq.com/course/5871-php-mysql-with-basic-javascript-integrated-course i really thank you for providing such information it was helpful.

    ReplyDelete