Se você deseja obter uma região usando JS, isso deve funcionar:
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();
}
});
Esse foi o mapeamento encontrado no AWS DOCS, em resposta à chamada da API de metadados, basta aparar o último caractere que deve funcionar.
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