Hi , is there any way to describe the resources th...
# aws
h
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
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
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 urnpulumiterra_stack:terra cdawslb/loadBalancerLoadBalancernnnlb 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
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
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
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
thanks so much!