Créer une politique incluse
Vous pouvez créer une politique incluse intégrée à un utilisateur ou un groupe. Les politiques incluses sont ainsi appliquées à cet utilisateur ou à tous les utilisateurs appartenant à ce groupe.
Créer une politique incluse avec OSC CLI
Créer une politique incluse intégrée à un utilisateur
|
À ce jour, cette section est disponible en anglais uniquement. |
The PutUserPolicy command creates or updates an inline policy included in a specified user.
The policy is automatically applied to the user after its creation.
|
A delay of up to 15 seconds can occur when creating or deleting an inline policy. |
$ osc-cli api PutUserPolicy --profile "default" \
--PolicyDocument '"{\"Statement\": [ {\"Effect\": \"Allow\", \"Action\": [\"*\"], \"Resource\": [\"*\"]} ]}"' \
--PolicyName "example-user-policy" \
--UserName "example-user"
This command contains the following attributes that you need to specify:
-
DryRun: (optional) If true, checks whether you have the required permissions to perform the action. -
PolicyDocument: The policy document, corresponding to a JSON string that contains the policy. For more information, see EIM Reference Information and EIM Policy Generator. -
PolicyName: The name of the policy (between 1 and 128 characters). -
UserName: The name of the user.
The PutUserPolicy command returns the following elements:
-
ResponseContext: Information about the context of the response.-
RequestId: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Créer une politique incluse intégrée à un groupe
|
À ce jour, cette section est disponible en anglais uniquement. |
The PutUserGroupPolicy command creates or updates an inline policy included in a specified group.
The policy is automatically applied to all the users of the group after its creation.
|
A delay of up to 15 seconds can occur when creating or deleting an inline policy. |
$ osc-cli api PutUserGroupPolicy --profile "default" \
--PolicyDocument '"{\"Statement\": [ {\"Effect\": \"Allow\", \"Action\": [\"*\"], \"Resource\": [\"*\"]} ]}"' \
--PolicyName "example-usergroup-policy" \
--UserGroupName "example-usergroup" \
--UserGroupPath "/example/"
This command contains the following attributes that you need to specify:
-
DryRun: (optional) If true, checks whether you have the required permissions to perform the action. -
PolicyDocument: The policy document, corresponding to a JSON string that contains the policy. For more information, see EIM Reference Information and EIM Policy Generator. -
PolicyName: The name of the policy. -
UserGroupName: The name of the group. -
UserGroupPath: (optional) The path to the group. If not specified, it is set to a slash (/).
The PutUserGroupPolicy command returns the following elements:
-
ResponseContext: Information about the context of the response.-
RequestId: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Créer une politique incluse avec oapi-cli
Créer une politique incluse intégrée à un utilisateur
|
À ce jour, cette section est disponible en anglais uniquement. |
The PutUserPolicy command creates or updates an inline policy included in a specified user.
The policy is automatically applied to the user after its creation.
|
A delay of up to 15 seconds can occur when creating or deleting an inline policy. |
$ oapi-cli --profile "default" PutUserPolicy \
--PolicyDocument --jsonstr-file "policy.json" \
--PolicyName "example-user-policy" \
--UserName "example-user"
This command contains the following attributes that you need to specify:
-
DryRun: (optional) If true, checks whether you have the required permissions to perform the action. -
PolicyDocument: The policy document, corresponding to a JSON string that contains the policy. For more information, see EIM Reference Information and EIM Policy Generator. -
PolicyName: The name of the policy (between 1 and 128 characters). -
UserName: The name of the user.
The PutUserPolicy command returns the following elements:
-
ResponseContext: Information about the context of the response.-
RequestId: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Créer une politique incluse intégrée à un groupe
|
À ce jour, cette section est disponible en anglais uniquement. |
The PutUserGroupPolicy command creates or updates an inline policy included in a specified group.
The policy is automatically applied to all the users of the group after its creation.
|
A delay of up to 15 seconds can occur when creating or deleting an inline policy. |
$ oapi-cli --profile "default" PutUserGroupPolicy \
--PolicyDocument --jsonstr-file "policy.json" \
--PolicyName "example-usergroup-policy" \
--UserGroupName "example-usergroup" \
--UserGroupPath "/example/"
This command contains the following attributes that you need to specify:
-
DryRun: (optional) If true, checks whether you have the required permissions to perform the action. -
PolicyDocument: The policy document, corresponding to a JSON string that contains the policy. For more information, see EIM Reference Information and EIM Policy Generator. -
PolicyName: The name of the policy. -
UserGroupName: The name of the group. -
UserGroupPath: (optional) The path to the group. If not specified, it is set to a slash (/).
The PutUserGroupPolicy command returns the following elements:
-
ResponseContext: Information about the context of the response.-
RequestId: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Créer une politique incluse avec AWS CLI
Avant de commencer : Installez et configurez AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI. |
Créer une politique incluse intégrée à un utilisateur
Pour créer une nouvelle politique incluse intégrée à un utilisateur, utilisez la commande put-user-policy en suivant cette syntaxe :
$ aws iam put-user-policy \
--profile YOUR_PROFILE \
--user-name Jane \
--policy-name AdminAccess \
--policy-document file://policy \
--endpoint https://eim.eu-west-2.outscale.com
Cette commande contient les options suivantes 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. -
user-name: Le nom de l’utilisateur. -
policy-name: Le nom de la politique. -
policy-document: Le document de politique, correspondant à une chaîne JSON qui contient la politique. Pour en savoir plus, voir Informations de référence pour EIM et Générateur de politiques EIM. -
endpoint: Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.
La nouvelle politique incluse est intégrée à l’utilisateur spécifié.
|
Un délai pouvant aller jusqu’à 15 secondes peut se produire lors de la création ou de la suppression d’une politique incluse. |
Créer une politique incluse intégrée à un groupe
Pour créer une nouvelle politique incluse intégrée à un groupe, utilisez la commande put-group-policy en suivant cette syntaxe :
$ aws iam put-group-policy \
--profile YOUR_PROFILE \
--group-name Admin \
--policy-name AdminAccess \
--policy-document file://policy \
--endpoint https://eim.eu-west-2.outscale.com
Cette commande contient les options suivantes 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: Le nom du groupe. -
policy-name: Le nom de la politique. -
policy-document: Le document de politique, correspondant à une chaîne JSON qui contient la politique. Pour en savoir plus, voir Informations de référence pour EIM et Générateur de politiques EIM. -
endpoint: Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.
La nouvelle politique incluse est intégrée au groupe spécifié.
|
Un délai pouvant aller jusqu’à 15 secondes peut se produire lors de la création ou de la suppression d’une politique incluse. |
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.