aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

ec2.Instance provide static method like VPC fromLookup for `Instance` by tag or other filter

Open stevensu1977 opened this issue 6 years ago • 11 comments

:rocket: Feature Request

General Information

  • [x] :wave: I may be able to implement this feature request
  • [ ] :warning: This feature might incur a breaking change

Description

Can we provide ec2.Instance static method fromLookup like ec2.VCP fromLookup ? I think it's very useful for quick get ec2 instance from exits ec2 instances.

Proposed Solution

Environment

  • CDK CLI Version: 1.6.1
  • Module Version: 1.6.1
  • OS: all
  • Language: all

Other information

stevensu1977 avatar Sep 03 '19 01:09 stevensu1977

Its been almost a year... any chance this feature will added to the ec2 Instance?

nrahi avatar Aug 19 '20 17:08 nrahi

Same here. I am running into this as well

okonon avatar Feb 08 '21 16:02 okonon

+1

alexander-zimmermann avatar Oct 20 '21 09:10 alexander-zimmermann

+1

Dare2python avatar Jan 18 '22 11:01 Dare2python

+1

cyommer avatar Aug 02 '22 03:08 cyommer

+1

rtaburceanu-gd avatar Nov 22 '22 20:11 rtaburceanu-gd

This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue.

github-actions[bot] avatar May 14 '23 00:05 github-actions[bot]

We really need this man....in my CDK I need to target an existing EC2 instance in my targetgroup, is there a way to lookup the EC2 instance using the id or name?

maggoun avatar May 18 '23 14:05 maggoun

@maggoun If you want to register instances whose IDs are known to target group, you can use the InstanceIdTarget.

aetos382 avatar May 30 '23 07:05 aetos382

Is this capability enabled in CDK?

my case ec2 is a bastion host and it is not a target instance to any LB.

please suggest

vinsri-dev avatar Oct 15 '23 07:10 vinsri-dev

Any news on this?

jkaeske avatar Feb 21 '24 13:02 jkaeske

+1

dloez avatar Apr 23 '24 09:04 dloez

+1

mhorbulsdx avatar Jul 08 '24 15:07 mhorbulsdx