> For the complete documentation index, see [llms.txt](https://aws-postgresql-docs.beliciarodriguez.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aws-postgresql-docs.beliciarodriguez.com/ubuntu-configuring-instance/add-postgresql-roles.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.
