[HELP] Connecting to Multiple AWS regions programmatically

21 views
Skip to first unread message

Ankit Rohilla

unread,
May 21, 2019, 5:36:30 AM5/21/19
to kubernetes-sig-aws
Hi,
I am dead stuck at this point.
I am using AWS go-sdk to talk to AWS APIs. This requires REGION_NAME, ACCESS_KEY_ID and SECRET_ACCESS_KEY as inputs, either via environment variables or through two files (~/.aws/config and ~/.aws/credentials).
Problem is I can have multiple aws-regions in a single AWS account. So, what do I need to do such that my application can connect to all the regions that I specify and then fetch me the data of all the regions? Something like this REGION_NAME=["region1","region2"]. Or if this is not possible then please suggest some ways on how I can achieve this.

Please help. Any pointers would be useful.
Regards
Ankit Rohilla

cheng pan

unread,
May 30, 2019, 1:09:12 AM5/30/19
to Ankit Rohilla, kubernetes-sig-aws
You should be able to create multiple sessions with different region for each session. Then you can create multiple aws service clients with each of the session talk to the region.

See Configure AWS Region in https://docs.aws.amazon.com/sdk-for-go/api/ for more details

Cheng

--
You received this message because you are subscribed to the Google Groups "kubernetes-sig-aws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-...@googlegroups.com.
To post to this group, send email to kubernete...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-sig-aws/eb371a9c-b7b5-4cf1-8317-60edf0c29a40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ankit Rohilla

unread,
May 30, 2019, 1:37:01 AM5/30/19
to kubernetes-sig-aws
Hi,
Thanks for the help. I did the same thing as you suggested. I couldn't find any other way.
I thought maybe it can automatically create multiple sessions if I can specify multiple regions in a config file and it automatically picks up all the regions. But that wasn't the case.

Thanks and Regards,
Ankit Rohilla


On Thursday, 30 May 2019 10:39:12 UTC+5:30, cheng pan wrote:
You should be able to create multiple sessions with different region for each session. Then you can create multiple aws service clients with each of the session talk to the region.

See Configure AWS Region in https://docs.aws.amazon.com/sdk-for-go/api/ for more details

Cheng

On Tue, May 21, 2019 at 2:36 AM Ankit Rohilla <ankit.r...@gmail.com> wrote:
Hi,
I am dead stuck at this point.
I am using AWS go-sdk to talk to AWS APIs. This requires REGION_NAME, ACCESS_KEY_ID and SECRET_ACCESS_KEY as inputs, either via environment variables or through two files (~/.aws/config and ~/.aws/credentials).
Problem is I can have multiple aws-regions in a single AWS account. So, what do I need to do such that my application can connect to all the regions that I specify and then fetch me the data of all the regions? Something like this REGION_NAME=["region1","region2"]. Or if this is not possible then please suggest some ways on how I can achieve this.

Please help. Any pointers would be useful.
Regards
Ankit Rohilla

--
You received this message because you are subscribed to the Google Groups "kubernetes-sig-aws" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-sig-aws+unsub...@googlegroups.com.

Ankit Rohilla

unread,
May 30, 2019, 2:39:12 AM5/30/19
to kubernetes-sig-aws
One more thing,
I am fetching the cloudwatch events from SQS queue. Do I need to have separate SQS queues for different regions? Because I read in the docs that SQS queues are region specific and you can't share the messages. So I order to get cloudwatch events, I need to create one SQS queue per region and listen to that queue using the sqsclient.

So, it seems that I can't achieve this using a single SQS queue. Am I right?

Regards
Ankit R.
Reply all
Reply to author
Forward
0 new messages