Grâce aux différents alias AWS CLI, vous pouvez aisément manipuler vos ressources OUTSCALE. Voici quelques exemples pour débuter : 


Important

Vous devez créer le fichier suivant : ~/.aws/cli/alias

.aws/cli/alias
 [toplevel]
 # Lister toutes vos instances en fonctionnement
 ls-vm=ec2 describe-instances \
     --filter Name=instance-state-name,Values=running \
     --query 'Reservations[].Instances[].{ID: InstanceId, VPC: VpcId, "Private IP": PrivateIpAddress, "Public IP": PublicIpAddress,Key: KeyName,Name: Tags[?Key==`Name`].Value |    [0],"Security Group": SecurityGroups[0].GroupId ,Type: InstanceType, Volumes: BlockDeviceMappings[0].Ebs.VolumeId}' \
     --output table
 # Lister tous vos volumes
 ls-volumes=ec2 describe-volumes \
     --query 'Volumes[].{VolumeId: VolumeId,State: State,Size: Size,Name: Tags[0].Value,AZ: AvailabilityZone}' \
     --output table
 # Lister tous vos snapshots
 ls-snapshots=ec2 describe-snapshots \
     --query 'Snapshots[].{SnapshotId: SnapshotId,Description: Description, VolumeId: VolumeId,Size: VolumeSize,Name: Tags[0].Value}' \
     --output table
 # Lister tous vos security groups ouverts sur la plage de ports 0.0.0.0/0
 ls-open-ports=ec2 describe-security-groups \
   --filters Name=ip-permission.cidr,Values=0.0.0.0/0 \
   --query 'SecurityGroups[].{
     GroupName:GroupName,
     GroupId:GroupId,
     PortRanges:
       IpPermissions[?contains(IpRanges[].CidrIp, `0.0.0.0/0`)].[
         join(`:`, [IpProtocol, join(`-`, [to_string(FromPort), to_string(ToPort)])])
       ][]
   }' \
   --output text
Requête AWS CLI avec alias
$ aws ls-vm --region eu-west-2
Résultat
--------------------------------------------------------------------------------------------------------------------------------------------
|                                                             DescribeInstances                                                            |
+------------+-------------------+----------+-----------+-------------+-----------------+-----------------+---------------+----------------+
|     ID     |        Key        |  Name    | Platform  | Private IP  |    Public IP    | Security Group  |     Type      |      VPC       |
+------------+-------------------+----------+-----------+-------------+-----------------+-----------------+---------------+----------------+
|  i-5f070bbd|  user-eu-west-2   |  Fedora  |  Linux    |  10.8.13.28 |  171.33.95.101  |  sg-20cc20e7    |  t2.medium    |  None          |
|  i-1e80fc41|  Bees             |  None    |  Linux    |  10.0.3.144 |  None           |  sg-175cc268    |  tinav4.c4r2  |  vpc-d6f90876  |
|  i-2a43891f|  Bees             |  None    |  Linux    |  10.0.3.181 |  None           |  sg-175cc268    |  tinav4.c4r2  |  vpc-d6f90876  |
|  i-052a86ef|  Bees             |  Bouncer |  Linux    |  10.0.1.21  |  171.33.120.213 |  sg-f9cd8117    |  c4.large     |  vpc-d6f90876  |
+------------+-------------------+----------+-----------+-------------+-----------------+-----------------+---------------+----------------+


Si vous souhaitez exploiter le Cloud OUTSCALE avec AWS CLI  sans devoir spécifier à chaque fois les différents endpoints, procédez comme suit : 

Important

Assurez-vous de mettre à jour les endpoints à chaque nouvelle sortie d'une Région ou d'un service par 3DS OUTSCALE. Pour en savoir plus, voir Référence des Régions, endpoints et Availability Zones.

~/.aws/models/endpoints.json
{
  "partitions": [
    {
      "defaults": {
        "hostname": "{service}.{region}.{dnsSuffix}",
        "protocols": [
          "https"
        ],
        "signatureVersions": [
          "v4"
        ]
      },
      "dnsSuffix": "outscale.com",
      "partition": "osc",
      "partitionName": "Outscale",
      "regionRegex": "^(cloudgouv|us|eu|ap)\\-\\w+\\-\\d+$",
      "regions": {
        "eu-west-2": {
          "description": "EU (Paris)"
        },
        "cloudgouv-eu-west-1": {
          "description": "CloudGouv EU (Paris)"
        },
        "us-east-2": {
          "description": "US East (NY)"
        },
        "us-west-1": {
          "description": "US West (California)"
        },
		"ap-northeast-1": {
		  "description": "Japan (Tokyo)"
	 	}
      },
      "services": {
        "ec2": {
          "endpoints": {
            "eu-west-2": {"hostname": "fcu.eu-west-2.outscale.com"},
            "cloudgouv-eu-west-1": {"hostname": "fcu.cloudgouv-eu-west-1.outscale.com"},
            "us-east-2": {"hostname": "fcu.us-east-2.outscale.com"},
            "us-west-1": {"hostname": "fcu.us-west-1.outscale.com"},
			"ap-northeast-1": {"hostname": "fcu.ap-northeast-1.outscale.com"}
          }
        },
       "elasticloadbalancing": {
          "endpoints": {
            "eu-west-2": {"hostname": "lbu.eu-west-2.outscale.com"},
            "cloudgouv-eu-west-1": {"hostname": "lbu.cloudgouv-eu-west-1.outscale.com"},
            "us-east-2": {"hostname": "lbu.us-east-2.outscale.com"},
            "us-west-1": {"hostname": "lbu.us-west-1.outscale.com"},
			"ap-northeast-1": {"hostname": "lbu.ap-northeast-1.outscale.com"}
          }
        },
        "iam": {
          "endpoints": {
            "eu-west-2": {"hostname": "eim.eu-west-2.outscale.com"},
            "cloudgouv-eu-west-1": {"hostname": "eim.cloudgouv-eu-west-1.outscale.com"},
            "us-east-2": {"hostname": "eim.us-east-2.outscale.com"},
            "us-west-1": {"hostname": "eim.us-west-1.outscale.com"},
			"ap-northeast-1": {"hostname": "eim.ap-northeast-1.outscale.com"}
          }
        },
        "directconnect": {
          "endpoints": {
            "eu-west-2": {"hostname": "directlink.eu-west-2.outscale.com"},
            "cloudgouv-eu-west-1": {"hostname": "directlink.cloudgouv-eu-west-1.outscale.com"},
            "us-east-2": {"hostname": "directlink.us-east-2.outscale.com"},
            "us-west-1": {"hostname": "directlink.us-west-1.outscale.com"},
          }
        },
        "s3": {
          "endpoints": {
            "eu-west-2": {"hostname": "osu.eu-west-2.outscale.com","signatureVersions": ["s3v4"]},
            "cloudgouv-eu-west-1": {"hostname": "osu.cloudgouv-eu-west-1.outscale.com","signatureVersions": ["s3v4"]},          
            "us-east-2": {"hostname": "osu.us-east-2.outscale.com","signatureVersions": ["s3"]},
            "us-west-1": {"hostname": "osu.us-west-1.outscale.com","signatureVersions": ["s3"]}
          }
        }
      }
    }
  ],
  "version": 3
}


En utilisant ce nouveau modèle, votre requête AWS CLI aura un nouveau format : 

  • Avant 
$ aws ec2 describe-instances --instance-ids i-12345678 i-87654321 i-12348765 i-56784321 --endpoint https://fcu.eu-west-2.outscale.com
  • Après
$ aws ec2 describe-instances --instance-ids i-12345678 i-87654321 i-12348765 i-56784321

Note

Vous devrez utiliser le paramètre region pour basculer d'une Région à une autre.


AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.