# Add Role to PostgreSQL Server

To start using PostgreSQL, we will need a user and a database.

First, we'll switch to the postgres user account on our instance.&#x20;

```
sudo su postgres
```

To run PostgresSQL, type

```
psql
```

In the next two lines, we'll create a user role who will be able to login and create databases ([3](https://medium.com/better-programming/how-to-provision-a-cheap-postgresql-database-in-aws-ec2-9984ff3ddaea)). Replace `username` and `'password'` with your own:

```sql
CREATE ROLE username 
WITH SUPERUSER CREATEDB CREATEROLE LOGIN ENCRYPTED PASSWORD 'password';
```

To stop running PostgresSQL, type

```sql
\q
```

To log out of the postgres account, type

```sql
exit
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aws-postgresql-docs.beliciarodriguez.com/ubuntu-configuring-instance/add-postgresql-roles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
