When the user selects an Amazon service (s3,CloudFront, etc) from a drop-down menu, I'd like to show only those regions/locations available for the selected service.
How can I determine this information? Is there a way to query Amazon's Global Infrastructure region table using RestAPI or dotNet?
The AWS Global Cloud Infrastructure is the most secure, extensive, and reliable cloud platform, offering over 200 fully featured services from data centers globally.
Q: What is the proper structure of AWS Global Infrastructure? T: A VPC is your private, logically isolated section of AWS. T: Route Tables are what direct the flow of traffic between resources within a VPC. Q: Availability Zones allow for this type of cloud architecture?
The AWS cloud spans 81 Availability Zones within 25 worldwide geographic regions.
AWS Systems Manager can help with this. It has SDKs for various languages as well as a rest API.
For example, to get all the regions for the AWS Athena You can use GetParametersByPath
with the path /aws/service/global-infrastructure/services/athena/regions
After answer by @adi-dembak, Here are my steps to achieve this task in .net
Add following SSM Managed Policy in aws and assign policy to user.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "rule1",
"Effect": "Allow",
"Action": [
"ssm:PutParameter",
"ssm:GetParametersByPath"
],
"Resource": "*"
}
]}
Install AWSSDK.SimpleSystemsManagement
string accessKey = "123##";
string secretKey = "321##";
HashSet<string> hash = new HashSet<string>();
AmazonSimpleSystemsManagementClient amazonSimpleSystemsManagementClient =
new AmazonSimpleSystemsManagementClient(accessKey, secretKey, Amazon.RegionEndpoint.USEast1);
GetParametersByPathRequest getParametersByPathRequest = new GetParametersByPathRequest();
getParametersByPathRequest.Path = "/aws/service/global-infrastructure/services/s3/regions/";
getParametersByPathRequest.Recursive = true;
GetParametersByPathResponse getParametersByPathResponse;
do
{
getParametersByPathResponse = await amazonSimpleSystemsManagementClient.GetParametersByPathAsync(getParametersByPathRequest);
foreach (Parameter item in getParametersByPathResponse.Parameters)
{
hash.Add(item.Value);
}
getParametersByPathRequest.NextToken = getParametersByPathResponse.NextToken;
}
while ((getParametersByPathResponse.NextToken != null) && !string.IsNullOrEmpty(getParametersByPathResponse.NextToken.ToString()));
//Print HashSet
foreach (string item in hash)
{
Console.WriteLine(item);
}
GetParametersByPath is a paged operation. After each call you must retrieve NextToken from the result object, and if it's not null and not empty you must make another call with it added to the request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With