Skip to content

Create security group

POST
/api/v1/security-group
curl --request POST \
--url https://console.cloudlogics.com/api/v1/security-group \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "description": "Public web tier", "name": "web-servers", "rules": [ { "description": "HTTPS from anywhere", "direction": "ingress", "dst_port": "443", "ethertype": "IPv4", "protocol": "tcp", "remote_group": "8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2", "remote_ip": "0.0.0.0/0" } ] }'

Create a security group in the authenticated user’s project. Available to any active project member; the group is tagged with the creator’s email so they may later edit or delete it. May optionally include rules to create atomically with the group; if any rule fails, the security group is rolled back.

Security group fields

Media typeapplication/json
object
description

Optional free text.

string
Example
Public web tier
name
required

3-50 characters, a single word of a-z, 0-9 and hyphens. Uppercase is converted to lowercase. Required: omitting it returns 400 “name cannot be empty”.

string
Example
web-servers
rules

Optional. Rules to create together with the group, using the same shape as POST /security-group/{id}/rule. Omit to create an empty group, which admits no inbound traffic until you add rules.

Array<object>
object
description

Optional free text, stored with the rule.

string
Example
HTTPS from anywhere
direction

Ingress for inbound traffic, egress for outbound.

string
Allowed values: ingress egress
Example
ingress
dst_port

Destination port, sent as a string rather than a number. Omit for icmp. Comes back as the integers port_range_min and port_range_max.

string
Example
443
ethertype

Comes back as ether_type, with an underscore.

string
Allowed values: IPv4 IPv6
Example
IPv4
protocol

Lowercase. Uppercase is not accepted.

string
Allowed values: tcp udp icmp
Example
tcp
remote_group

The UUID of another security group, to allow traffic from anything using that group. Use this or remote_ip, not both.

string
Example
8f14e45f-ceea-467a-9f2c-1b1d3a5e77c2
remote_ip

Source or destination CIDR. 0.0.0.0/0 is the whole internet; a /32 is a single address. Use this or remote_group, not both. Comes back as remote_ip_prefix.

string
Example
0.0.0.0/0

Created security group ID and rules

Media typeapplication/json
object
key
additional properties
any
Examplegenerated
{}

Invalid request

Media typeapplication/json
object
data
error
object
code
integer
message
string
page
object
next
string
prev
string
total_size
integer
Example
{
"error": {
"code": 400,
"message": "name cannot be empty"
}
}

One of the provided rules already exists; SG rolled back

Media typeapplication/json
object
data
error
object
code
integer
message
string
page
object
next
string
prev
string
total_size
integer
Examplegenerated
{
"data": "example",
"error": {
"code": 1,
"message": "example"
},
"page": {
"next": "example",
"prev": "example",
"total_size": 1
}
}

Internal server error

Media typeapplication/json
object
data
error
object
code
integer
message
string
page
object
next
string
prev
string
total_size
integer
Examplegenerated
{
"data": "example",
"error": {
"code": 1,
"message": "example"
},
"page": {
"next": "example",
"prev": "example",
"total_size": 1
}
}