Skip to Content
APINetworksSecurity GroupsCreate, Rename and Delete

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
FieldTypeRequiredDescription
SecurityGroupNamestringyes1 to 255 characters
SecurityGroupDescriptionstringnoUp to 500 characters
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"? } }.

StatusCodeWhen
400validation_errorA field is missing or malformed, or the id is not a security group id
404not_foundNo such security group in your account
409security_group_in_useThe group is still attached to an instance: set the instance’s groups without it first
409default_security_groupThe default group cannot be deleted
409quota_exceededYour account is at its limit of security groups
Last updated on