In this tutorial, you’ll learn how to create an account with the Amazon web service (AWS), set up your external relational database and connect it for using in an Appery.io app with API Express.
- Open the link – https://aws.amazon.com.
- Click Create a Free Account.
- In the new page, enter the e-mail, select I am a new user. and click Sign in using our secure server.
- On the next page, fill in all the fields and click Create account.
- The next step is providing all the contact information. After that, click Create Account and Continue.
- After that, enter your payment information and click Continue.
- The next step is your identity verification by telephone. Make all the necessary corrections in the fields and click Call Me Now. After you get a call from an automated system, you’ll be prompted to enter your PIN-number on the phone.
- If everything has been done correctly, you’ll be redirected to the next page where you should select the AWS Support Plan and click Continue.
Congratulations! Your registration has been completed.
- Now, you can login with your account on the main page.
- Proceed with your login and password.
- After the successful login, you’ll get access to the Amazon Web Services console. Choose the Database > RDS.
- On the next page, select Instances.
- And then click Launch DB Instance.
- Then select a DB Engine (here – PostgreSQL) and confirm your choice.
- On the next step, select No (if the DB accessibility in several zones is not critical in your case) and click Next Step.
- On the next step, you should specify the DB details for the instance. In the example, we use db.t2.micro, and, for Multi-AZ Deployment select No.
- If needed, configure the network and security settings and/or the database options.
Mind the message that appears when you select Create new Security Group for the VPC Security Group(s).
By default, accessing the database is made possible with the current mail (the instance was created with), but below you will find how you can change it, if necessary.
- After all the necessary fields have been filled in, click Launch DB Instance.
- As a result, the success message appears.
- Now, let’s click View your DB Instances and wait for the instance to be created. When the status changes to available, your database is ready and can be used. Click the triangle sign on the left to open the full view.
- For getting access, we use the following:
- URL – Endpoint.
- Port – Port.
- Database name – DB Name.
- Username and password– the previously set credentials.
- If any changes to the database security are necessary (for accessing the database from other addresses), follow this link for Security Groups.
- In the new window, select Actions > Edit inbound rules.
- Then, select Anywhere for Source (you can also define a desired address by selecting Custom IP) and click Save.
Now, to start working with API Express, we need to create a table(s) by using special database tools.
- Let’s take, as an example, pgAdmin: http://www.pgadmin.org/index.php.
- Download the soft, install it, and run.
- On the main page, click Add a connection to a server.
- Fill in all the necessary fields (see step 15 from the Logging into AWS and Creating DB section above), define any name you like and confirm.
- In the Object browser view, select the newly created connection.
- Open the connections tree and switch to Databases > NewDB > Schemas > Public > Tables.
- Right-click on Tables, then select New Table.
- In the new window, enter the name and switch to the Columns tab
- Add the columns to your table by clicking Add and defining their names and types.
- In our example, we add two columns: (id – serial and name – character varying).
- Now, let’s add a Primary key: on the Constraints tab, click Add.
- In the drop-down, select id, click Add, and then – OK.
- In the New Table dialog, also click OK.
Let’s add some data to the table.
- In pgAdmin III, right-click on the table in Tables (here it’s NewTable), then select View Data, and then – View All Rows.
- In the new page, enter some data into the fields provided.
Make sure that the table has a primary key defined.
Now, when we have a table filled in, let’s create an app and check how our model works.
Please follow the steps in Exposing Your Database to API Express.
- In the Appery.io builder, go to the API Express tab.
- There, click Create new DB connection, fill in all the required information (see step 15 from the Logging into AWS and Creating DB section above), enter any name, select Relational database as Connectional type, and, for Database type, select PostgreSQL.
- To ensure it works, click Test and then Save.
- Now, let’s create a new project: under the same API Express tab, click Create new project, enter its name and click Create.
- Open it and click on the new model.
- In the new window, enter the name, select connection, and table, and click Save.
- The model saved and can now be tested.
Updated 8 months ago