Create and manage users
Prerequisites
Section titled “Prerequisites”- You have created a PostgreSQL Flex instance.
Check Create and manage instances for PostgreSQL Flex.
List, create, view and delete a user
Section titled “List, create, view and delete a user”List users
Section titled “List users”To get a list of all users for a PostgreSQL Flex instance:
| Flag | Description |
|---|---|
| instance-id | Instance ID of the instance you want to query |
stackit postgresqlflex user list --instance-id <instance-id>You get something like the following output:
ID │ USERNAME───────┼─────────────────── 16843 │ crm-tutorial-user- Open your project in the STACKIT Portal.
- Navigate to Databases > PostgreSQL Flex.
- Choose your instance and go to the overview.
- In the sidebar, select Users.
Now you can see the list of users.
Create a user
Section titled “Create a user”To create a user for a PostgreSQL Flex instance:
| Flag | Description | Default | Optional |
|---|---|---|---|
| instance-id | Instance ID of the instance you want to query | ||
| username | Username of the new user | ||
| role | Permissions of the user (login, createdb) | login | x |
stackit postgresflex user create --instance-id <instance-id> --username <username> --role <first-role> --role <second-role> ...You get the following output:
Created user for instance "postgres-qaeq2npfyl75". User ID: 16853
Username: stackit-user-guide-usersPassword: pEjB7MK7HRaLfiNAECnObgpY03w1710p5ZfUAyHkDe2hY5vJqhoiMjOVKFLy986eRoles: [login createdb]Host: a9b3b1dd-308e-4a00-b269-11d136e65824.postgresql.eu01.onstackit.cloudPort: 5432URI: postgresql://stackit-user-guide-users:pEjB7MK7HRaLfiNAECnObgpY03w1710p5ZfUAyHkDe2hY5vJqhoiMjOVKFLy986e@a9b3b1dd-308e-4a00-b269-11d136e65824.postgresql.eu01.onstackit.cloud:5432/stackit- Open your project in the STACKIT Portal.
- Navigate to Databases > PostgreSQL Flex.
- Choose your instance and go to the overview.
- In the sidebar, select Users.
- In the top bar, click on Create user.
- Enter a username.
- In the Role menu, add CreateDB and Login.
- Click on Create.
- Copy all information to a safe place. You can’t retrieve it again.
View a user
Section titled “View a user”To get details of a user for a PostgreSQL Flex instance:
| Flag | Description | Default | Optional |
|---|---|---|---|
| instance-id | Instance ID of the instance you want to query | ||
| user-id | The ID of the user (not its username) |
stackit postgresqlflex user describe <user-id> --instance-id <instance-id>You get the following output:
ID │ 16690─────────┼──────────────────────────────────────────────────────────────────────USERNAME │ stackit-user-guide-users─────────┼──────────────────────────────────────────────────────────────────────ROLES │ [createdb login]─────────┼──────────────────────────────────────────────────────────────────────HOST │ a9b3b1dd-308e-4a00-b269-11d136e65824.postgresql.eu01.onstackit.cloud─────────┼──────────────────────────────────────────────────────────────────────PORT │ 5432- Open your project in the STACKIT Portal.
- Navigate to Databases > PostgreSQL Flex.
- Choose your instance and go to the overview.
- In the sidebar, select Users.
- Click on the user entry you want to view.
Delete a user
Section titled “Delete a user”To delete a user for a PostgreSQL Flex instance:
| Flag | Description | Default | Optional |
|---|---|---|---|
| instance-id | Instance ID of the instance you want to query | ||
| user-id | The ID of the user (not its username) |
stackit PostgreSQLflex user delete <user-id> --instance-id <instance-id>After confirmation, you get the following output:
Deleted user "z8n9ybsi" of instance "PostgreSQL-87ffl67rc1dd"- Open your project in the STACKIT Portal.
- Navigate to Databases > PostgreSQL Flex.
- Choose your instance and go to the overview.
- In the sidebar, select Users.
- Click on the three dots on the right side of a user entry.
- Click on Delete.