JS kullanarak bölge almak istiyorsanız, bu çalışmalıdır:
meta.request("/latest/meta-data/placement/availability-zone",function(err,data){
if(err)
console.log(err);
else{
console.log(data);
str = data.substring(0, data.length - 1);
AWS.config.update({region:str});
ec2 = new AWS.EC2();
}
});
Bu, meta veri API çağrısına yanıt olarak AWS DOCS'ta bulunan eşlemeydi, çalışması gereken son karakteri kırpmanız yeterli.
eu-west-1a :eu-west-1
eu-west-1b :eu-west-1
eu-west-1c :eu-west-1
us-east-1a :us-east-1
us-east-1b :us-east-1
us-east-1c :us-east-1
us-east-1d :us-east-1
ap-northeast-1a :ap-northeast-1
ap-northeast-1b :ap-northeast-1
us-west-1a :us-west-1
us-west-1b :us-west-1
us-west-1c :us-west-1
ap-southeast-1a :ap-southeast-1
ap-southeast-1b :ap-southeast-1