You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesi贸n a prueba de IA

Antes: $249

Currency
$209
Suscr铆bete

Termina en:

2 D铆as
13 Hrs
1 Min
44 Seg

El mundo de la Base de Datos

16/30
Resources

How to configure a database within AWS?

Setting up a database on AWS is not just a matter of following a mechanical procedure. It requires an understanding of how cloud resources are organized and protected, particularly when employing VPCs (Virtual Private Clouds) to maintain the security and isolation of your data. In this guide, you will learn how to connect your database within an AWS VPC, configuring a custom security group to control access, and finally, creating and managing the PostgreSQL database in AWS using RDS.

What is a VPC and how is it configured?

A VPC, or Virtual Private Cloud, is an isolated network that lives within the AWS infrastructure. Resources within a VPC are protected from public access unless otherwise configured. To get started:

  1. Log in to the AWS console: search for the VPC service and select the default VPC offered by AWS. Examine its settings, especially the access control lists, subnets, and routing tables.

  2. Configure a secure VPC: Make sure that all resources that should communicate within the system, for example, a database and Lambda functions, are configured within the same VPC, creating an isolated and secure environment.

How do you create security groups in AWS?

A Security Group is crucial for managing who and what can access your resources within the VPC. To set up a Security Group for your database, follow these steps:

  1. Head to the EC2 dashboard: Here you will find the Security Groups section.

  2. Create a new security group: Assign a name and description. Example:

    • Name: Database Sec Group
    • Description: Hello Traffic into the Database
  3. Define the inbound rules: Allow only traffic from your local machine. For example, for PostgreSQL, enable port 5432 for your IP address only.

    Incoming Traffic:- Type: PostgreSQL- Port: 5432- Source: Your IP address with mask /32
  4. Generate the security group: After configuring the inbound rules, save the configuration.

How to create a PostgreSQL database in AWS RDS?

AWS RDS is a service that facilitates the creation and management of databases. To create a PostgreSQL database:

  1. Access the RDS console: Choose DB Instances and click Create Database.

  2. Choose the Standard Create: option for further customization. Select PostgreSQL as the database engine.

  3. Define the basic settings: Set a database name and primary user. For security, enable credential management through Secrets Manager.

  4. Configure connectivity and networking: Use the default VPC and specify that it is publicly accessible, ensuring that traffic only comes from your IP using the previously configured Security Group.

  5. Encrypt traffic with SSL certificates: Activate and review additional configurations such as performance insights or backups, as needed.

  6. Create the database: Your PostgreSQL database will be ready in a few minutes.

How to connect and manage the database with tools like pgAdmin?

Once your database is ready, you can manage it with tools like pgAdmin:

  1. Connect using pgAdmin: Go to Register, select Server, and fill in the connection details with the hostname, port, and credentials saved in Secrets.

  2. Create a table in your database: Use the Query Tool to write and execute SQL commands, for example, to create a Commits table.

    CREATE TABLE Commits ( id SERIAL PRIMARY KEY, repo_name VARCHAR(100), commit_id VARCHAR(40), commit_message TEXT);

To summarize

Setting up a database within a VPC on AWS ensures security and control over your resources. By using Security Groups and database management tools, you can customize access and manage your data efficiently. Don't forget to explore more about AWS RDS to further optimize your data infrastructures!

Contributions 3

Questions 0

Sort by:

Want to see more contributions, questions and answers from the community?

```js CREATE TABLE commits ( id SERIAL PRIMARY KEY, repo_name VARCHAR(255) NOT NULL, commit_id VARCHAR(255) UNIQUE NOT NULL, commit_message VARCHAR (255) NOT NULL, author_username VARCHAR(255) NOT NULL, author_email VARCHAR(255) NOT NULL, payload JSONB NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); ```
Si a alguien mas no le conecta verificar porque en mi caso cambiaba la IP muy seguido pero el rango se manten铆a por ejemplo tuve que dejar el permiso en la regla de entrada del SG para 181.205.155.0/24
```js CREATE TABLE commits ( id SERIAL PRIMARY KEY, repo_name VARCHAR(255) NOT NULL, commit_id VARCHAR(255) UNIQUE NOT NULL, commit_message VARCHAR (255) NOT NULL, author_username VARCHAR(255) NOT NULL, author_email VARCHAR(255) NOT NULL, payload JSONB NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); ```CREATE TABLE commits ( id SERIAL PRIMARY KEY, repo\_name VARCHAR(255) NOT NULL, commit\_id VARCHAR(255) UNIQUE NOT NULL, commit\_message VARCHAR (255) NOT NULL, author\_username VARCHAR(255) NOT NULL, author\_email VARCHAR(255) NOT NULL, payload JSONB NOT NULL, created\_at TIMESTAMP DEFAULT CURRENT\_TIMESTAMP, updated\_at TIMESTAMP DEFAULT CURRENT\_TIMESTAMP );