THE INDIA LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AppML using Amazon Database


Amazon RDS is a database cloud service.

It is easy to set up and manage.

It is FREE to try!

What is Amazon Relational Database Service (RDS)

Amazon Relational Database Service (RDS) is a cloud based database service.


Why use Amazon RDS?

Amazon RDS manages many of the challenges of running a database.

With Amazon RDS you can scale performance and storage as you need it.

Amazon RDS manages automated backups, patching, and recovery.

It supports popular database products like:

  • MySQL
  • PostgreSQL
  • Oracle
  • Microsoft SQL Server
  • and the new, MySQL-compatible Amazon Aurora DB engine

Getting Started

Before you can start using RDS, you need to sign up for Amazon Web Services, and set up a database user and security group.


Sign Up for Amazon Web Services

When you sign up for Amazon Web Services (AWS), your AWS account is automatically signed up for all services in AWS, including Amazon RDS.

If you are a new AWS customer, you can get started with Amazon RDS for free.

The AWS Free Tier is allows you to try AWS for free for 12 months after you sign up. For more information, see AWS Free Usage Tier.

If you decide to continue with AWS after your free period (or if you need more storage or performance than the free usage tier offers), you only pay for the resources you use.

To create an AWS account go to: http://aws.amazon.com/, and then click Sign Up.

Follow the on-screen instructions. Note your AWS account number, because you'll need it later.


Create a MySQL Database Instance

In this example we will set up a free Database instance running MySQL. (This is free because it is intended for testing).

 Create a MySQL DB instance:

  1. Go to Amazon RDS console: https://console.aws.amazon.com/rds/
  2. In the navigation pane, click Instances.
  3. Click Launch DB Instance
  4. On the Select Engine page, click the MySQL icon and then click Select for the MySQL DB engine
  5. On the Production? page, click checkbox next to "No, this instance is intended for use outside of production.......", and then click Next Step
  6. On the Specify DB Details page follow the instructions (follow these instructions for setting up a free test database)
    For this option:Typical Input
    License Modelgeneral-public-license
    DB Engine VersionSelect the default version of MySQL
    DB Instance ClassSelect db.t2.micro to select a configuration that is eligible for free test usage
    Multi-AZ DeploymentSelect No
    Storage TypeMagnetic (Standard)
    Allocated Storage5
    DB Instance IdentifierType the name of your database instance (this is not the name of your database)
    Master UsernameType the master username for your database
    Master PasswordType the password for your master user
    Confirm PasswordConform the password
  7. On the Configure Advanced Settings page follow the instructions (follow these instructions for setting up a free test database)
    For this option:Typical Input
    VPCDefault VPC
    Subnet Groupdefault
    Publicly AccessibleYes
    Availability ZoneNo Preference
    VPC Security Group(s)default
    Database NameType the name of your database (in this example, we will show you how to create the northwind database we use for examples in the AppML tutorial)
    Database Port3306 (unless you need it to run on a specific port)
    DB Parameter GroupKeep the default value
    Option GroupKeep the default value
    Enable EncryptionNo
    Backup Retention Period7
    Backup WindowNo Preference
    Auto Minor Version UpgradeYes
    Maintenance WindowNo Preference
  8. Click Launch DB Instance
  9. Click View Your DB Instances
  10. The new DB instance appears in the list of DB instances (it will have a "creating" status until it is ready for use)
  11. When the status changes to "available", you can connect to the database
  12. Click the details icon to view details and copy the URL from "Endpoint", including the port

The Endpoint URL should look something like this:

databasename.aaabbbcccddd.region.rds.amazonaws.com:3306

Configure Database Connection in AppML

To configure the database connection, edit the appml_config file:

PHP example: appml_config.php

<?php echo("Access Forbidden");exit();?>
{
"dateformat" : "yyyy-mm-dd",
"databases" : [{
"connection" : "mydatabase",
"host" : "yourDatabaseURL",
"dbname" : "yourDatabaseName",
"username" : "yourUserName",
"password" : "yourPassword"
}]
}

Edit the following:

  1. mydatabase - change to whatever you want the database connection to be called in your application
  2. yourDatabaseURL - change to the endpoint URL from the previous step
  3. yourDatabaseName - change to the name you specified for your database in Amazon RDS
  4. yourUserName - change to the username you specified for your database in Amazon RDS
  5. yourPassword - change to the password you specified for your database in Amazon RDS

AppML should now be configured to connect to your Amazon RDS database.

You can now fill your database with data:

Optional: Create an IAM User for increased security

Amazon RDS, require that you provide username and password when you access it.

You can access the account with your Amazon username, but for security purposes we recommend that you create an Identity and Access Management (IAM) user, for your database.

First, create the Administrators group:

  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/
  2. In the menu, click Groups, then click Create New Group
  3. In the Group Name box, type Administrators and then click Next Step
  4. In the list of policies, select the check box next to the AdministratorAccess policy
  5. Click Next Step, then click Create Group

Then create the IAM user, and add it to the Administrators group:

  1. In the menu, click Users, then click Create New User
  2.  In box 1, enter a user name
  3. Clear the check box next to "Generate an access key for each user", then click Create
  4. In the list of users, click the name (not the check box) of the user you just created
  5. In the Groups section, click Add User to Groups
  6. Select the check box next to the Administrators group, then click Add to Groups
  7. Scroll down to the Security Credentials section, and click Manage Password
  8. Select Assign a custom password, then enter a password in the Password and Confirm Password boxes, click Apply

To sign in as this new IAM user, sign out of the AWS console, then use the following URL:

Login with IAM

https://your_aws_account_id.signin.aws.amazon.com/console/

Replace your_aws_account_id with your AWS account number without the hyphens (if your account number is 1234-5678-9012, your AWS account ID is 123456789012)