Obtain vagrant-aws instance ID

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Obtain vagrant-aws instance ID

Robert Fynes
Hi,

Is it possible to get the EC2 instance ID of an instance launched using the vagrant-aws plugin, and if so, how?

Thanks,
-Rob

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Mike
From inside or outside?

On Friday, June 14, 2013, Robert Fynes wrote:
Hi,

Is it possible to get the EC2 instance ID of an instance launched using the vagrant-aws plugin, and if so, how?

Thanks,
-Rob

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;vagrant-up%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">vagrant-up+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Robert Fynes
From outside.


On 14 June 2013 12:33, Mike <[hidden email]> wrote:
From inside or outside?


On Friday, June 14, 2013, Robert Fynes wrote:
Hi,

Is it possible to get the EC2 instance ID of an instance launched using the vagrant-aws plugin, and if so, how?

Thanks,
-Rob

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Robert Fynes
In reply to this post by Robert Fynes
Actually, I'm trying to get the public DNS name of the launched instance, but I think I'd like to get the instance ID too.
I'd actually like to get as much information as possible about the instance, but if I have the instance ID, I guess I can use the ec2 api to get whatever I want.

Maybe I should be using Chefs knife ec2 tool instead of Vagrant. My understanding is that Vagrant provides the kind of abstraction so that you don't have to concern yourself with the instance details.
Still, I'd like to use Vagrant.

On Friday, 14 June 2013 12:30:12 UTC+1, Robert Fynes wrote:
Hi,

Is it possible to get the EC2 instance ID of an instance launched using the vagrant-aws plugin, and if so, how?

Thanks,
-Rob

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Mike
In reply to this post by Robert Fynes
Dunno. You might inspect around this variable 
https://github.com/mitchellh/vagrant-aws/blob/master/lib/vagrant-aws/action/run_instance.rb#L93

On Friday, June 14, 2013, Robert Fynes wrote:
From outside.


On 14 June 2013 12:33, Mike <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;miketheman@gmail.com&#39;);" target="_blank">miketheman@...> wrote:
From inside or outside?


On Friday, June 14, 2013, Robert Fynes wrote:
Hi,

Is it possible to get the EC2 instance ID of an instance launched using the vagrant-aws plugin, and if so, how?

Thanks,
-Rob

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;vagrant-up%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">vagrant-up+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;vagrant-up%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">vagrant-up+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Robert Fynes
In reply to this post by Robert Fynes
I got this to work:

rfynes@rfynes-laptop$ vagrant ssh --command 'curl -s http://169.254.169.254/latest/meta-data/instance-id'
i-9a91e7d7

...this is the list of metadata that you can pull:

rfynes@rfynes-laptop$ vagrant ssh --command 'curl -s http://169.254.169.254/latest/meta-data/'
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
instance-action
instance-id
instance-type
kernel-id
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups

...and user-data is possible too. 
It's probably not ideal, though (e.g. windows). I think I'd still prefer to pull the id from vagrant, if possible, and then use ec2 tools to get whatever I want.

I'll take a closer look at the source that you referred to, thanks!


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Torben Knerr
You can use the vagrant-awsinfo plugin to get the instance id from the outside:


On Fri, Jun 14, 2013 at 2:29 PM, Robert Fynes <[hidden email]> wrote:
I got this to work:

rfynes@rfynes-laptop$ vagrant ssh --command 'curl -s http://169.254.169.254/latest/meta-data/instance-id'
i-9a91e7d7

...this is the list of metadata that you can pull:

rfynes@rfynes-laptop$ vagrant ssh --command 'curl -s http://169.254.169.254/latest/meta-data/'
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
instance-action
instance-id
instance-type
kernel-id
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups

...and user-data is possible too. 
It's probably not ideal, though (e.g. windows). I think I'd still prefer to pull the id from vagrant, if possible, and then use ec2 tools to get whatever I want.

I'll take a closer look at the source that you referred to, thanks!


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Robert Fynes
Perfect, thanks.

On Friday, 14 June 2013 17:27:52 UTC+1, Torben Knerr wrote:
You can use the vagrant-awsinfo plugin to get the instance id from the outside:


On Fri, Jun 14, 2013 at 2:29 PM, Robert Fynes <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="nELvmT9MKekJ">fyn...@...> wrote:
I got this to work:

rfynes@rfynes-laptop$ vagrant ssh --command 'curl -s http://169.254.169.254/latest/meta-data/instance-id'
i-9a91e7d7

...this is the list of metadata that you can pull:

rfynes@rfynes-laptop$ vagrant ssh --command 'curl -s http://169.254.169.254/latest/meta-data/'
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
instance-action
instance-id
instance-type
kernel-id
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups

...and user-data is possible too. 
It's probably not ideal, though (e.g. windows). I think I'd still prefer to pull the id from vagrant, if possible, and then use ec2 tools to get whatever I want.

I'll take a closer look at the source that you referred to, thanks!


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="nELvmT9MKekJ">vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Robert Fynes
In reply to this post by Robert Fynes
For what it's worth, I've discovered that after running 'vagrant up', the automatically generated .vagrant directory (in the root) contains a file .vagrant/machines/default/aws/id (or similar).

This file contains the EC2 instance ID of the launched instance (and nothing else - no line-break).

On Friday, 14 June 2013 12:30:12 UTC+1, Robert Fynes wrote:
Hi,

Is it possible to get the EC2 instance ID of an instance launched using the vagrant-aws plugin, and if so, how?

Thanks,
-Rob

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Obtain vagrant-aws instance ID

Torben Knerr

I believe 'vagrant ssh-config' should do as well and does not require an additional plugin to be installed.

Have heard of it but not tried it yet...

On Jul 16, 2013 5:02 PM, "Robert Fynes" <[hidden email]> wrote:
For what it's worth, I've discovered that after running 'vagrant up', the automatically generated .vagrant directory (in the root) contains a file .vagrant/machines/default/aws/id (or similar).

This file contains the EC2 instance ID of the launched instance (and nothing else - no line-break).

On Friday, 14 June 2013 12:30:12 UTC+1, Robert Fynes wrote:
Hi,

Is it possible to get the EC2 instance ID of an instance launched using the vagrant-aws plugin, and if so, how?

Thanks,
-Rob

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.