Créer une route table

Vous pouvez créer une route table que vous pouvez associer à un ou plusieurs Subnets pour contrôler la façon dont leur trafic est routé. Une fois votre route table créée, vous pouvez y créer des routes pour personnaliser le routage des Subnets auxquels elle est associée.

Chaque route table contient la route local qui route le trafic ciblant une IP du bloc CIDR du Net localement. Cette route ne peut être ni modifiée ni supprimée.

Créer une route table avec Cockpit v2

Avant de commencer : Créez un Net. Pour en savoir plus, voir Créer un Net.

  1. Dans le dashboard Route Tables, cliquez sur IconAddFull Créer une route table.
    La boîte de dialogue CRÉER UNE ROUTE TABLE apparaît.

  2. Dans le champ Nom, tapez un nom pour la route table.

    Cette action ajoute un tag Name de 255 caractères maximum. Vous pouvez utiliser tous les caractères, y compris les lettres accentuées.

  3. Depuis la liste de sélection Net, sélectionnez le Net pour lequel vous souhaitez créer la route table.

  4. Cliquez sur Créer une route table.
    La route table est créée.

Créer une route table avec OSC CLI

Avant de commencer : Créez un Net. Pour en savoir plus, voir Créer un Net.

À ce jour, cette section est disponible en anglais uniquement.

The CreateRouteTable command creates a route table for a specified Net.
You can then add routes and associate this route table with a Subnet.

For more information, see About Route Tables.

Request sample
$ osc-cli api CreateRouteTable --profile "default" \
    --NetId "vpc-12345678"

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.

  • NetId: The ID of the Net for which you want to create a route table.

The CreateRouteTable command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

  • RouteTable: Information about the route table.

    • LinkRouteTables: One or more associations between the route table and Subnets.

      • LinkRouteTableId: The ID of the association between the route table and the Net or Subnet.

      • Main: If true, the route table is the main one.

      • NetId: The ID of the Net, if the route table is not explicitly linked to a Subnet.

      • RouteTableId: The ID of the route table.

      • SubnetId: The ID of the Subnet, if the route table is explicitly linked to a Subnet.

    • NetId: The ID of the Net for the route table.

    • RoutePropagatingVirtualGateways: Information about virtual gateways propagating routes.

      • VirtualGatewayId: The ID of the virtual gateway.

    • RouteTableId: The ID of the route table.

    • Routes: One or more routes in the route table.

      • CreationMethod: The method used to create the route.

      • DestinationIpRange: The IP range used for the destination match, in CIDR notation (for example, 10.0.0.0/24).

      • DestinationServiceId: The ID of the OUTSCALE service.

      • GatewayId: The ID of the Internet service or virtual gateway attached to the Net.

      • NatServiceId: The ID of a NAT service attached to the Net.

      • NetAccessPointId: The ID of the Net access point.

      • NetPeeringId: The ID of the Net peering.

      • NicId: The ID of the NIC.

      • State: The state of a route in the route table (always active).

      • VmAccountId: The account ID of the owner of the VM.

      • VmId: The ID of a VM specified in a route in the table.

    • Tags: One or more tags associated with the route table.

      • Key: The key of the tag, with a minimum of 1 character.

      • Value: The value of the tag, between 0 and 255 characters.

Result sample
{
  "RouteTable": {
    "Routes": [
      {
        "DestinationIpRange": "10.0.0.0/16",
        "CreationMethod": "CreateRouteTable",
        "State": "active"
      }
    ],
    "LinkRouteTables": [],
    "NetId": "vpc-12345678",
    "Tags": [],
    "RoutePropagatingVirtualGateways": [],
    "RouteTableId": "rtb-12345678"
  },
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Créer une route table avec AWS CLI

Avant de commencer : Créez un VPC. Pour en savoir plus, voir Créer un Net.

Pour créer une route table, utilisez la commande create-route-table en suivant cette syntaxe :

Exemple de requête
$ aws ec2 create-route-table \
    --profile YOUR_PROFILE \
    --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.

  • vpc-id : L’ID du VPC.

  • endpoint : Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête.

La commande create-route-table renvoie les éléments suivants :

  • RouteTable : Informations à propos de la route table nouvellement créée. Cet élément contient les informations suivantes :

    • Association : Une ou plusieurs associations entre la route table et des subnets.

    • RouteTableId : L’ID de la route table.

    • VpcId : L’ID du VPC.

    • PropagatingVgws : L’ID de la virtual private gateways (VGW) propageant les routes à l’aide du protocole BGP.

    • Tags : Un ou plusieurs tags associés à la route table. Cet élément contient les informations suivantes :

      • value : La valeur du tag.

      • key : La clé du tag.

    • Routes : Informations à propos des routes que contient la route table (uniquement la route local lors de la création). Cet élément contient les informations suivantes :

      • GatewayId : La target utilisée pour la route (ici, local).

      • DestinationCidrBlock : La plage d’IP de destination (ici, le bloc CIDR du VPC).

      • State : L’état de la route.

Exemple de résultat
 {
    "RouteTable": {
        "Associations": [],
        "RouteTableId": "rtb-87654321",
        "VpcId": "vpc-123456782",
        "PropagatingVgws": [],
        "Tags": [],
        "Routes": [
            {
                "GatewayId": "local",
                "DestinationCidrBlock": "10.0.0.0/16",
                "State": "active"
            }
        ]
    }
}

La route table est créée.

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.