Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:30:19+00:00 2026-06-18T12:30:19+00:00

I am using boto, the code like this: dev_xvdb = boto.ec2.blockdevicemapping.EBSBlockDeviceType(volume_id=’vol-xxxxxx’) bdm = boto.ec2.blockdevicemapping.BlockDeviceMapping()

  • 0

I am using boto, the code like this:

dev_xvdb = boto.ec2.blockdevicemapping.EBSBlockDeviceType(volume_id='vol-xxxxxx')
bdm = boto.ec2.blockdevicemapping.BlockDeviceMapping()
bdm['/dev/xvdb'] = dev_xvdb

rs = ec2.request_spot_instances(price=MY_MAX_PRICE,
                                image_id='ami-xxxxx',
                                count=1,
                                type='one-time',
                                key_name='MY_KEY_NAME',
                                security_groups=['default'],
                                instance_type='t1.micro',
                                block_device_map=bdm)

This code can be run properly, but can’t attach the EBS volume(id=vol-xxxxxx). Why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:30:20+00:00Added an answer on June 18, 2026 at 12:30 pm

    I think the problem here is that you cannot attach an existing volume to an instance with BlockDeviceMapping. The BlockDeviceMapping allows you to specify either a volume size or a snapshot-id. If you specify a size, it will create a new, blank volume of that size and attach it to the device you specify. If you specify a snapshot-id, it will create a new volume from that snapshot and attach it.

    If you want to attach an existing volume to an instance you have to use the attach_volume method which can only be run after you have an instance ID.

    Why then, you might ask, does boto’s EBSBlockDeviceType have a volume_id attribute? That’s because when we do a get_all_instances call, the data returned by AWS for BlockDeviceMapping includes the volume_id for currently connected EBS volumes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using python and boto this is my code: key = bucket.get_key(key_name) if
I'm using the boto library in Python to connect to DynamoDB. The following code
I have a python script using the boto library on ec2 instance which is
I'm new to Python, and stumped by this piece of code from the Boto
I'm using boto to spawn a new EC2 instance based on an AMI. The
I am using Boto to create an AMI of one of my EC2 boxes,
i am using the boto python module for polling amazon ec2 instances, however it
I'm using boto in Python to automate some of my EC2 workflow. The issue
I've been using fabric and boto to start up new ec2 hosts for some
I am trying to set up EMR workflow (with DynamoDB and Hive) using boto

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.