Create, rename and delete security groups
A new security group allows every outbound connection and nothing inbound. Add inbound rules with add a rule, then attach the group to instances with set an instance’s groups.
Instances get their groups by name, so keep names unique in your account.
Create a group
POST /v1/security_groups| Field | Type | Required | Description |
|---|---|---|---|
| SecurityGroupName | string | yes | 1 to 255 characters |
| SecurityGroupDescription | string | no | Up to 500 characters |
cURL
curl -X POST https://api.redu.cloud/v1/security_groups \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"SecurityGroupName": "db-from-app", "SecurityGroupDescription": "Postgres, from the app only"}'201 Created returns the new group, with the same fields as the list, including the outbound rules it starts with.
Rename a group
PUT /v1/security_groups/{id}Same body as create. Send the current name to change only the description. The group’s rules and instances stay as they are. Returns the group.
Delete a group
DELETE /v1/security_groups/{id}curl -X DELETE https://api.redu.cloud/v1/security_groups/1c62ad45-128d-45d9-b164-6cefdf5e8739 \
-H "x-api-key: YOUR_API_KEY"Answers once the group is gone:
{ "deleted": true, "id": "1c62ad45-128d-45d9-b164-6cefdf5e8739" }Errors
Errors use the API’s standard shape, { "error": { "code", "message", "hint"? } }.
| Status | Code | When |
|---|---|---|
| 400 | validation_error | A field is missing or malformed, or the id is not a security group id |
| 404 | not_found | No such security group in your account |
| 409 | security_group_in_use | The group is still attached to an instance: set the instance’s groups without it first |
| 409 | default_security_group | The default group cannot be deleted |
| 409 | quota_exceeded | Your account is at its limit of security groups |
Last updated on