Data in Configservice #1881
Replies: 2 comments 1 reply
-
Hi @c0sm1k , This is hard to know without seeing the way you set up your request but if I had to guess you are not specifying the correct region in your config: cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("<YOUR DESIRED REGION GOES HERE>")) Here is my working code: func main() {
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("<YOUR DESIRED REGION GOES HERE>"))
if err != nil {
log.Fatalf("unable to load SDK config, %v", err)
}
res, err := client.BatchGetResourceConfig(context.Background(), &configservice.BatchGetResourceConfigInput{
ResourceKeys: []types.ResourceKey{
{
ResourceId: aws.String(myInstanceID),
ResourceType: "AWS::EC2::Instance",
},
},
})
if err != nil {
panic(err)
}
for _, key := range res.BaseConfigurationItems {
fmt.Println(*key.AwsRegion)
}
} Let me know if this helps. |
Beta Was this translation helpful? Give feedback.
-
Hi @RanVaknin Thanks for responding quick. We have set configuration, created client through NewFromConfig(<aws.Config>) (This is done). We need the region where resource is located. How can we get it?
Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi there,
Service : Configsevrice
Function : BatchGetResourceConfig
I've noticed that for some items such as EC2, ARN is empty in the response.
Also the "AwsRegion" field in response, SDK says - "The Region where resource resides", but we are getting wrong region.
Ex : EC2 Instance is in us-east-2, but response says it's in us-east-1.
Can you please help me to get the correct region where the resources reside in?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions