【问题标题】:passing the name while creating a volume in aws-ec2 using jclouds使用 jclouds 在 aws-ec2 中创建卷时传递名称
【发布时间】:2014-11-16 09:13:37
【问题描述】:

我正在使用下面的代码部分使用 jclouds api 在 ec2 中创建一个卷。

            EC2Api ec2Api = computeServiceContext.unwrapApi(EC2Api.class);
            LOG.info("initialized ec2 api for volume creation");

            org.jclouds.ec2.domain.Volume volume = ec2Api
                    .getElasticBlockStoreApi()
                    .get()
                    .createVolumeInAvailabilityZone("ap-southeast-1b", size);
            responseTemplate.setJobId(volume.getId());
            responseTemplate.setCreationTime(volume.getCreateTime());
            responseTemplate.setZoneId(volume.getAvailabilityZone());

现在没有选项可以在创建时传递卷的名称。但我想列出与卷名相关的卷。请让我知道是否有在创建卷时传递卷名并在使用 describeVolume 时在卷详细信息中获取卷名。

【问题讨论】:

    标签: java amazon-web-services amazon-ec2 jclouds


    【解决方案1】:

    在 AWS EC2 中,为卷分配名称只不过是创建一个名为 Name 的标签。

    这不是CreateVolume API的功能:http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVolume.html

    但是,有一个专用的CreateTags API 为资源分配标签:http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-CreateTags.html

    所以,同样在 jcloud 中,您需要弄清楚将如何调用 CreateTags 的方法/函数/api

    Per:https://groups.google.com/forum/#!topic/jclouds/Wr83TmOX6Rw,jCloud 没有这个功能。但是,您可能需要检查当前状态。

    【讨论】:

    • 我已经为 ec2 使用了 TagApi,现在我可以设置卷名了。非常感谢您的建议。但我无法在 ec2 的卷的列表详细信息中列出卷名。卷名没有出现...有什么想法吗?
    猜你喜欢
    • 2014-05-29
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 2015-04-10
    • 1970-01-01
    • 1970-01-01
    • 2019-02-23
    • 1970-01-01
    相关资源
    最近更新 更多