https://pulumi.com logo
Title
h

hundreds-receptionist-31352

04/20/2020, 5:40 PM
Hi , is there any way to describe the resources that are created in aws account? , taking into account that is wasn't provisioned with pulumi , just I need to get some ids of NLB for example but it was created manually in the past
g

gentle-diamond-70147

04/20/2020, 5:56 PM
Each resource type has a
.get()
method to retrieve details of an individual resource by its ID - e.g. https://www.pulumi.com/docs/reference/pkg/aws/ec2/vpc/#look-up-an-existing-vpc-resource.
You can always use the AWS SDK in your Pulumi applications as well if the Pulumi SDK doesn't provide the lookup functions you need.
h

hundreds-receptionist-31352

04/20/2020, 8:39 PM
sorry I'm very newbie with it , I have tried const prov = new aws.Provider("prov"); const alb = aws.lb.LoadBalancer.get("albx",prov) and I get error: Preview failed: refreshing urnđŸ˜›ulumi:terra_stack::terra_cd::aws:lb/loadBalancer:LoadBalancer::nnnlb: Error retrieving ALB: ValidationError: 'e2d442cd-f267-416c-9204-8f4c6a63ac77' is not a valid load balancer ARN status code: 400, request id: 868eb50f-24e3-4111-ac13-2845eb12ec2f , do you have same example , using it with resources created manually?
g

gentle-diamond-70147

04/20/2020, 10:05 PM
You need to do something like this
const alb = <http://aws.lb|aws.lb>.LoadBalancer.get("albx", "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188");
where you provide the full ARN of the ALB to lookup.
You can likely omit the
const prov = new aws.Provider("prov");
part unless you need to explicitly configure the provider.
h

hundreds-receptionist-31352

04/20/2020, 11:41 PM
yes but that arn of the ALB is that I wanna get with pulumi, Don't know if it possible to get a list of loadbalancer that exists in a aws account without specifying the arn
g

gentle-diamond-70147

04/21/2020, 12:26 AM
No, I think we currently only support retrieving a single ALB by ARN with the Pulumi SDK. But, you can use the AWS SDK as part of your Pulumi app. That way you can call the
describeLoadBalancers
in the AWS SDK to get the list of loadbalancers.
h

hundreds-receptionist-31352

04/21/2020, 1:55 PM
thanks so much!