Package com.amazonaws.services.ec2.model

Examples of com.amazonaws.services.ec2.model.EbsBlockDevice


        }

        /* Generate key pair in Amazon if necessary */
        try {
            /* Get current key pair in Amazon */
            DescribeKeyPairsRequest describeKeyPairsRequest = new DescribeKeyPairsRequest();
            ec2.describeKeyPairs(describeKeyPairsRequest.withKeyNames(keyPairName));

            /* If key exists and new key is created, delete old key and replace
             * with new one. Else, do nothing */
            if (newKey) {
                DeleteKeyPairRequest deleteKeyPairRequest = new DeleteKeyPairRequest(keyPairName);
View Full Code Here


   *
   * @return list of keypairs
   */
  public static List<String> loadKeypairs(){
    List<String> resultList = new ArrayList<String>();
    DescribeKeyPairsResult results = getEC2Client().describeKeyPairs();
    for (KeyPairInfo key : results.getKeyPairs()) {
      resultList.add(key.getKeyName());
    }
    return resultList;
  }
View Full Code Here

        {
            registerImageRequest = registerImageRequest.
                    withBlockDeviceMappings(
                            new BlockDeviceMapping().
                                    withDeviceName(rootDeviceName.get()).
                                    withEbs(new EbsBlockDevice().
                                            withSnapshotId(testSnapshot.get().getSnapshotId())),
                            new BlockDeviceMapping().
                                    withDeviceName("/dev/sda2").
                                    withVirtualName("ephemeral0"),
                            new BlockDeviceMapping().
                                    withDeviceName("/dev/sda3").
                                    withVirtualName("ephemeral1"));
        }
        else
        {
            registerImageRequest = registerImageRequest.
                    withBlockDeviceMappings(
                            new BlockDeviceMapping().
                                    withDeviceName(rootDeviceName.get()).
                                    withEbs(new EbsBlockDevice().
                                            withSnapshotId(testSnapshot.get().getSnapshotId())),
                            new BlockDeviceMapping().
                                    withDeviceName("/dev/sdb").
                                    withVirtualName("ephemeral0"),
                            new BlockDeviceMapping().
View Full Code Here

        // Create the block device mapping to describe the root partition.
        BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
        blockDeviceMapping.setDeviceName("/dev/sda1");

        // Set the delete on termination flag to false.
        EbsBlockDevice ebs = new EbsBlockDevice();
        ebs.setDeleteOnTermination(Boolean.FALSE);
        blockDeviceMapping.setEbs(ebs);

        // Add the block device mapping to the block list.
        ArrayList<BlockDeviceMapping> blockList = new ArrayList<BlockDeviceMapping>();
        blockList.add(blockDeviceMapping);
View Full Code Here

            // Create the block device mapping to describe the root partition.
            BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
            blockDeviceMapping.setDeviceName("/dev/sda1");

            // Set the delete on termination flag to false.
            EbsBlockDevice ebs = new EbsBlockDevice();
            ebs.setDeleteOnTermination(Boolean.FALSE);
            blockDeviceMapping.setEbs(ebs);

            // Add the block device mapping to the block list.
            ArrayList<BlockDeviceMapping> blockList = new ArrayList<BlockDeviceMapping>();
            blockList.add(blockDeviceMapping);
View Full Code Here

        List<BlockDeviceMapping> blockDeviceMappings = Lists.newArrayList();
        if (blockDevices != null && blockDevices.size() > 0) {
            for (BlockDevice device : blockDevices) {
                blockDeviceMappings.add(new BlockDeviceMapping()
                    .withDeviceName(device.getName())
                    .withEbs(new EbsBlockDevice()
                        .withVolumeSize(device.getSize())
                        .withDeleteOnTermination(true)
                    ));
            }
        }
View Full Code Here

        {
            registerImageRequest = registerImageRequest.
                    withBlockDeviceMappings(
                            new BlockDeviceMapping().
                                    withDeviceName(rootDeviceName.get()).
                                    withEbs(new EbsBlockDevice().
                                            withSnapshotId(testSnapshot.get().getSnapshotId())),
                            new BlockDeviceMapping().
                                    withDeviceName("/dev/sda2").
                                    withVirtualName("ephemeral0"),
                            new BlockDeviceMapping().
                                    withDeviceName("/dev/sda3").
                                    withVirtualName("ephemeral1"));
        }
        else
        {
            registerImageRequest = registerImageRequest.
                    withBlockDeviceMappings(
                            new BlockDeviceMapping().
                                    withDeviceName(rootDeviceName.get()).
                                    withEbs(new EbsBlockDevice().
                                            withSnapshotId(testSnapshot.get().getSnapshotId())),
                            new BlockDeviceMapping().
                                    withDeviceName("/dev/sdb").
                                    withVirtualName("ephemeral0"),
                            new BlockDeviceMapping().
View Full Code Here

      /** tag image devices */
      for (final BlockDeviceMapping blockDevice : image
          .getBlockDeviceMappings()) {

        final EbsBlockDevice elasticDevice = blockDevice.getEbs();

        if (elasticDevice == null) {
          continue;
        }

        final String snapshotId = elasticDevice.getSnapshotId();

        if (snapshotId == null) {
          continue;
        }

View Full Code Here

    imageUnregister(imageId);

    for (final BlockDeviceMapping blockDevice : image
        .getBlockDeviceMappings()) {

      final EbsBlockDevice elasticDevice = blockDevice.getEbs();

      if (elasticDevice == null) {
        continue;
      }

      final String snapshotId = elasticDevice.getSnapshotId();

      if (snapshotId == null) {
        continue;
      }
View Full Code Here

    private void refreshSnapshotToAMIs() {
        snapshotToAMIs.clear();
        for (Image image : getAWSClient().describeImages()) {
            for (BlockDeviceMapping bdm : image.getBlockDeviceMappings()) {
                EbsBlockDevice ebd = bdm.getEbs();
                if (ebd != null && ebd.getSnapshotId() != null) {
                    LOGGER.debug(String.format("Snapshot %s is used to generate AMI %s",
                            ebd.getSnapshotId(), image.getImageId()));
                    Collection<String> amis = snapshotToAMIs.get(ebd.getSnapshotId());
                    if (amis == null) {
                        amis = new ArrayList<String>();
                        snapshotToAMIs.put(ebd.getSnapshotId(), amis);
                    }
                    amis.add(image.getImageId());
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.ec2.model.EbsBlockDevice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.