Using Boto to determine if an AWS AMI is available
I am using Boto to create an AMI of one of my EC2 boxes, and then I would like to spin up more boxes with that AMI, but the run_instances
command is barking that my AMI is not available yet.
How can I use boto to query aws to find out when my ami is ready?
The EC2 connection supports a method to get_image
But the Image does not have any sort of status attribute
python amazon-web-services boto
add a comment |
I am using Boto to create an AMI of one of my EC2 boxes, and then I would like to spin up more boxes with that AMI, but the run_instances
command is barking that my AMI is not available yet.
How can I use boto to query aws to find out when my ami is ready?
The EC2 connection supports a method to get_image
But the Image does not have any sort of status attribute
python amazon-web-services boto
add a comment |
I am using Boto to create an AMI of one of my EC2 boxes, and then I would like to spin up more boxes with that AMI, but the run_instances
command is barking that my AMI is not available yet.
How can I use boto to query aws to find out when my ami is ready?
The EC2 connection supports a method to get_image
But the Image does not have any sort of status attribute
python amazon-web-services boto
I am using Boto to create an AMI of one of my EC2 boxes, and then I would like to spin up more boxes with that AMI, but the run_instances
command is barking that my AMI is not available yet.
How can I use boto to query aws to find out when my ami is ready?
The EC2 connection supports a method to get_image
But the Image does not have any sort of status attribute
python amazon-web-services boto
python amazon-web-services boto
asked May 3 '12 at 18:10
MattoToddMattoTodd
5,197104771
5,197104771
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
a quick dir of Image led me to Image.state
with values like "pending"
and "available"
add a comment |
In addition to "pending" and "available" there is also the "failed" state. This is the full set of AMI states available.
add a comment |
I used the above method but it took a little while for me to figure it out. Not a python person but here is what I did. Hope it helps someone.
#EC2 Connection
conn = boto.ec2.connect()
image_status = conn.get_all_images(image_ids='ami-XXX')[0]
image_state = image_status.state
print image_state
add a comment |
I can write a simple function using boto3
def check_ami_exists(ami_id, region):
client = boto3.client('ec2', region_name = region)
response = client.describe_images()
for image in response['Images']:
if ami_id == image['ImageId']:
return True
return False
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10437026%2fusing-boto-to-determine-if-an-aws-ami-is-available%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
a quick dir of Image led me to Image.state
with values like "pending"
and "available"
add a comment |
a quick dir of Image led me to Image.state
with values like "pending"
and "available"
add a comment |
a quick dir of Image led me to Image.state
with values like "pending"
and "available"
a quick dir of Image led me to Image.state
with values like "pending"
and "available"
answered May 3 '12 at 18:21
MattoToddMattoTodd
5,197104771
5,197104771
add a comment |
add a comment |
In addition to "pending" and "available" there is also the "failed" state. This is the full set of AMI states available.
add a comment |
In addition to "pending" and "available" there is also the "failed" state. This is the full set of AMI states available.
add a comment |
In addition to "pending" and "available" there is also the "failed" state. This is the full set of AMI states available.
In addition to "pending" and "available" there is also the "failed" state. This is the full set of AMI states available.
answered Jul 26 '12 at 18:49
OkezieEOkezieE
3,43711923
3,43711923
add a comment |
add a comment |
I used the above method but it took a little while for me to figure it out. Not a python person but here is what I did. Hope it helps someone.
#EC2 Connection
conn = boto.ec2.connect()
image_status = conn.get_all_images(image_ids='ami-XXX')[0]
image_state = image_status.state
print image_state
add a comment |
I used the above method but it took a little while for me to figure it out. Not a python person but here is what I did. Hope it helps someone.
#EC2 Connection
conn = boto.ec2.connect()
image_status = conn.get_all_images(image_ids='ami-XXX')[0]
image_state = image_status.state
print image_state
add a comment |
I used the above method but it took a little while for me to figure it out. Not a python person but here is what I did. Hope it helps someone.
#EC2 Connection
conn = boto.ec2.connect()
image_status = conn.get_all_images(image_ids='ami-XXX')[0]
image_state = image_status.state
print image_state
I used the above method but it took a little while for me to figure it out. Not a python person but here is what I did. Hope it helps someone.
#EC2 Connection
conn = boto.ec2.connect()
image_status = conn.get_all_images(image_ids='ami-XXX')[0]
image_state = image_status.state
print image_state
answered Nov 26 '14 at 23:40
EzosEzos
11017
11017
add a comment |
add a comment |
I can write a simple function using boto3
def check_ami_exists(ami_id, region):
client = boto3.client('ec2', region_name = region)
response = client.describe_images()
for image in response['Images']:
if ami_id == image['ImageId']:
return True
return False
add a comment |
I can write a simple function using boto3
def check_ami_exists(ami_id, region):
client = boto3.client('ec2', region_name = region)
response = client.describe_images()
for image in response['Images']:
if ami_id == image['ImageId']:
return True
return False
add a comment |
I can write a simple function using boto3
def check_ami_exists(ami_id, region):
client = boto3.client('ec2', region_name = region)
response = client.describe_images()
for image in response['Images']:
if ami_id == image['ImageId']:
return True
return False
I can write a simple function using boto3
def check_ami_exists(ami_id, region):
client = boto3.client('ec2', region_name = region)
response = client.describe_images()
for image in response['Images']:
if ami_id == image['ImageId']:
return True
return False
answered Nov 24 '18 at 6:09
rakeshzrakeshz
264
264
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10437026%2fusing-boto-to-determine-if-an-aws-ami-is-available%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown