Créer un security group
Vous pouvez créer des security groups pour le Cloud public ou pour un Net que vous spécifiez. Vous devez ensuite ajouter des règles à ces security groups selon vos besoins et votre architecture.
De la même manière que nous recommandons d’utiliser une VM pour un service uniquement, nous recommandons de créer un security group par service avec les règles appropriées, et d’associer ce security group avec toutes les VMs dédiées à ce service. Vous pouvez ensuite autoriser les flux entrants et sortants entre vos security groups selon les services qui doivent communiquer entre eux pour appliquer ces règles à l’ensemble des VMs concernées.
Créer un security group avec Cockpit v2
Avant de commencer :
|
-
Dans le dashboard Security Groups, cliquez sur Créer un security group.
La boîte de dialogue CRÉER UN SECURITY GROUP apparaît. -
Dans le champ Nom, entrez un nom pour le security group.
-
Le nom doit être unique dans votre compte pour le Cloud public ou pour chaque Net.
-
Le nom du security group ne doit pas commencer par
sg-
ou par une espace. -
Le nom doit contenir entre 1 et 255 caractères. Les caractères autorisés sont
a-z
,A-Z
,0-9
, l’espace, et_.-:/()#,@[]+=&;{}!$*
.
Donnez des noms explicites à vos security groups afin que leur rôle soit compris plus facilement. Vous pouvez par exemple utiliser des noms au format application-environnement-rôle :
-
website-all-bastion
-
website-front-lb
-
website-middle-app
-
website-back-db
-
-
Dans le champ Description, entrez une description du security group.
La description doit contenir entre 1 et 255 caractères. Les caractères autorisés sont
a-z
,A-Z
,0-9
, les lettres accentuées, l’espace, et_.-:/()#,@[]+=&;{}!$*
. -
Dans la liste Net, effectuez une des actions suivantes :
-
Pour créer un security group pour le Cloud public, sélectionnez Aucun Net dans la liste de Net.
-
Pour créer un security group pour un Net, sélectionnez ce Net dans la liste de Net.
-
-
Cliquez sur Créer.
Le security group est créé.
Créer un security group avec OSC CLI
Avant de commencer :
|
À ce jour, cette section est disponible en anglais uniquement. |
The CreateSecurityGroup command creates a security group.
This action creates a security group either in the public Cloud or in a specified Net. By default, a default security group for use in the public Cloud and a default security group for use in a Net are created.
When launching a virtual machine (VM), if no security group is explicitly specified, the appropriate default security group is assigned to the VM. Default security groups include a default rule granting VMs network access to each other.
When creating a security group, you specify a name. Two security groups for use in the public Cloud or for use in a Net cannot have the same name.
You can have up to 500 security groups in the public Cloud. You can create up to 500 security groups per Net.
To add or remove rules, use the CreateSecurityGroupRule method.
For more information, see About Security Groups.
$ osc-cli api CreateSecurityGroup --profile "default" \
--NetId "vpc-12345678" \
--SecurityGroupName "security-group-example" \
--Description "Security group example"
This command contains the following attributes that you need to specify:
-
Description
: A description for the security group.
This description can contain between 1 and 255 characters. Allowed characters area-z
,A-Z
,0-9
, accented letters, spaces, and_.-:/()#,@[]+=&;{}!$*
. -
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
NetId
: (optional) The ID of the Net for the security group. -
SecurityGroupName
: The name of the security group.
This name must not start withsg-
.
This name must be unique and contain between 1 and 255 characters. Allowed characters area-z
,A-Z
,0-9
, spaces, and_.-:/()#,@[]+=&;{}!$*
.
The CreateSecurityGroup command returns the following elements:
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
-
SecurityGroup
: Information about the security group.-
AccountId
: The account ID that has been granted permission. -
Description
: The description of the security group. -
InboundRules
: The inbound rules associated with the security group.-
FromPortRange
: The beginning of the port range for the TCP and UDP protocols, or an ICMP type number. -
IpProtocol
: The IP protocol name (tcp
,udp
,icmp
, or-1
for all protocols). By default,-1
. In a Net, this can also be an IP protocol number. For more information, see the IANA.org website. -
IpRanges
: One or more IP ranges for the security group rules, in CIDR notation (for example,10.0.0.0/16
). -
SecurityGroupsMembers
: Information about one or more source or destination security groups.-
AccountId
: The account ID that owns the source or destination security group. -
SecurityGroupId
: The ID of a source or destination security group that you want to link to the security group of the rule. -
SecurityGroupName
: (Public Cloud only) The name of a source or destination security group that you want to link to the security group of the rule.
-
-
ServiceIds
: One or more service IDs to allow traffic from a Net to access the corresponding OUTSCALE services. For more information, see ReadNetAccessPointServices. -
ToPortRange
: The end of the port range for the TCP and UDP protocols, or an ICMP code number.
-
-
NetId
: The ID of the Net for the security group. -
OutboundRules
: The outbound rules associated with the security group.-
FromPortRange
: The beginning of the port range for the TCP and UDP protocols, or an ICMP type number. -
IpProtocol
: The IP protocol name (tcp
,udp
,icmp
, or-1
for all protocols). By default,-1
. In a Net, this can also be an IP protocol number. For more information, see the IANA.org website. -
IpRanges
: One or more IP ranges for the security group rules, in CIDR notation (for example,10.0.0.0/16
). -
SecurityGroupsMembers
: Information about one or more source or destination security groups.-
AccountId
: The account ID that owns the source or destination security group. -
SecurityGroupId
: The ID of a source or destination security group that you want to link to the security group of the rule. -
SecurityGroupName
: (Public Cloud only) The name of a source or destination security group that you want to link to the security group of the rule.
-
-
ServiceIds
: One or more service IDs to allow traffic from a Net to access the corresponding OUTSCALE services. For more information, see ReadNetAccessPointServices. -
ToPortRange
: The end of the port range for the TCP and UDP protocols, or an ICMP code number.
-
-
SecurityGroupId
: The ID of the security group. -
SecurityGroupName
: The name of the security group. -
Tags
: One or more tags associated with the security group.-
Key
: The key of the tag, with a minimum of 1 character. -
Value
: The value of the tag, between 0 and 255 characters.
-
-
{
"SecurityGroup": {
"Tags": [],
"SecurityGroupName": "security-group-example",
"OutboundRules": [
{
"FromPortRange": -1,
"IpProtocol": "-1",
"ToPortRange": -1,
"IpRanges": [
"0.0.0.0/0"
]
}
],
"SecurityGroupId": "sg-12345678",
"AccountId": "123456789012",
"Description": "Example of security group",
"InboundRules": [],
"NetId": "vpc-12345678"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Créer un security group avec oapi-cli
Avant de commencer :
|
À ce jour, cette section est disponible en anglais uniquement. |
The CreateSecurityGroup command creates a security group.
This action creates a security group either in the public Cloud or in a specified Net. By default, a default security group for use in the public Cloud and a default security group for use in a Net are created.
When launching a virtual machine (VM), if no security group is explicitly specified, the appropriate default security group is assigned to the VM. Default security groups include a default rule granting VMs network access to each other.
When creating a security group, you specify a name. Two security groups for use in the public Cloud or for use in a Net cannot have the same name.
You can have up to 500 security groups in the public Cloud. You can create up to 500 security groups per Net.
To add or remove rules, use the CreateSecurityGroupRule method.
For more information, see About Security Groups.
$ oapi-cli --profile "default" CreateSecurityGroup \
--NetId "vpc-12345678" \
--SecurityGroupName "security-group-example" \
--Description "Security group example"
This command contains the following attributes that you need to specify:
-
Description
: A description for the security group.
This description can contain between 1 and 255 characters. Allowed characters area-z
,A-Z
,0-9
, accented letters, spaces, and_.-:/()#,@[]+=&;{}!$*
. -
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
NetId
: (optional) The ID of the Net for the security group. -
SecurityGroupName
: The name of the security group.
This name must not start withsg-
.
This name must be unique and contain between 1 and 255 characters. Allowed characters area-z
,A-Z
,0-9
, spaces, and_.-:/()#,@[]+=&;{}!$*
.
The CreateSecurityGroup command returns the following elements:
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
-
SecurityGroup
: Information about the security group.-
AccountId
: The account ID that has been granted permission. -
Description
: The description of the security group. -
InboundRules
: The inbound rules associated with the security group.-
FromPortRange
: The beginning of the port range for the TCP and UDP protocols, or an ICMP type number. -
IpProtocol
: The IP protocol name (tcp
,udp
,icmp
, or-1
for all protocols). By default,-1
. In a Net, this can also be an IP protocol number. For more information, see the IANA.org website. -
IpRanges
: One or more IP ranges for the security group rules, in CIDR notation (for example,10.0.0.0/16
). -
SecurityGroupsMembers
: Information about one or more source or destination security groups.-
AccountId
: The account ID that owns the source or destination security group. -
SecurityGroupId
: The ID of a source or destination security group that you want to link to the security group of the rule. -
SecurityGroupName
: (Public Cloud only) The name of a source or destination security group that you want to link to the security group of the rule.
-
-
ServiceIds
: One or more service IDs to allow traffic from a Net to access the corresponding OUTSCALE services. For more information, see ReadNetAccessPointServices. -
ToPortRange
: The end of the port range for the TCP and UDP protocols, or an ICMP code number.
-
-
NetId
: The ID of the Net for the security group. -
OutboundRules
: The outbound rules associated with the security group.-
FromPortRange
: The beginning of the port range for the TCP and UDP protocols, or an ICMP type number. -
IpProtocol
: The IP protocol name (tcp
,udp
,icmp
, or-1
for all protocols). By default,-1
. In a Net, this can also be an IP protocol number. For more information, see the IANA.org website. -
IpRanges
: One or more IP ranges for the security group rules, in CIDR notation (for example,10.0.0.0/16
). -
SecurityGroupsMembers
: Information about one or more source or destination security groups.-
AccountId
: The account ID that owns the source or destination security group. -
SecurityGroupId
: The ID of a source or destination security group that you want to link to the security group of the rule. -
SecurityGroupName
: (Public Cloud only) The name of a source or destination security group that you want to link to the security group of the rule.
-
-
ServiceIds
: One or more service IDs to allow traffic from a Net to access the corresponding OUTSCALE services. For more information, see ReadNetAccessPointServices. -
ToPortRange
: The end of the port range for the TCP and UDP protocols, or an ICMP code number.
-
-
SecurityGroupId
: The ID of the security group. -
SecurityGroupName
: The name of the security group. -
Tags
: One or more tags associated with the security group.-
Key
: The key of the tag, with a minimum of 1 character. -
Value
: The value of the tag, between 0 and 255 characters.
-
-
{
"SecurityGroup": {
"Tags": [],
"SecurityGroupName": "security-group-example",
"OutboundRules": [
{
"FromPortRange": -1,
"IpProtocol": "-1",
"ToPortRange": -1,
"IpRanges": [
"0.0.0.0/0"
]
}
],
"SecurityGroupId": "sg-12345678",
"AccountId": "123456789012",
"Description": "Example of security group",
"InboundRules": [],
"NetId": "vpc-12345678"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Créer un security group avec AWS CLI
Avant de commencer :
|
Pour créer un security group, utilisez la commande create-security-group en suivant cette syntaxe :
$ aws ec2 create-security-group \
--profile YOUR_PROFILE \
--group-name my-security-group \
--description security-group-description \
--vpc-id vpc-12345678 \
--endpoint https://fcu.eu-west-2.outscale.com
Cette commande contient les attributs suivants que vous devez spécifier :
-
(optionnel)
profile
: Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI. -
group-name
: Un nom unique pour le security group. -
description
: Une description du security group.-
Le nom doit être unique dans votre compte pour le Cloud public ou pour chaque VPC.
-
Le nom du security group ne doit pas commencer par
sg-
. -
Chaque nom et description peuvent contenir entre 1 et 255 caractères. Les caractères autorisés sont
a-z
,A-Z
,0-9
, l’espace, et_.-:/()#,@[]+=&;{}!$*
.
-
-
(optionnel)
vpc-id
: L’ID du VPC pour lequel vous souhaitez créer le security group. -
endpoint
: Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.Cet attribut est requis lorsque vous créez un security group pour un VPC.
La commande create-security-group renvoie les éléments suivants :
-
GroupId
: L’ID du nouveau security group.
{
"GroupId": "sg-12345678"
}
Le security group est créé.
Pages connexes
Méthodes API correspondantes
AWS™ et Amazon Web Services™ sont des marques de commerce d'Amazon Technologies, Inc. ou de ses affiliées aux États-Unis et/ou dans les autres pays.