InvalidLocationConstraint使用node.js aws-sdk在af-south-1(开普敦)区域中创建存储区 [英] InvalidLocationConstraint creating a bucket in af-south-1 (Cape Town) region using node.js aws-sdk

查看:239
本文介绍了InvalidLocationConstraint使用node.js aws-sdk在af-south-1(开普敦)区域中创建存储区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一个 InvalidLocationConstraint:尝试使用node.js aws-在af-south-1(开普敦)区域中创建S3存储桶时,指定的位置约束无效错误.sdk,版本为2.726.0(当时最新).

I am getting a InvalidLocationConstraint: The specified location-constraint is not valid error when trying to create a S3 bucket in the af-south-1 (Cape Town) region using node.js aws-sdk, at version 2.726.0 (The latest at the time).

该区域已启用,我可以使用管理控制台创建存储桶.我用于调试的IAM用户在该帐户中具有完全管理权限.

The region has been enabled and I am able to create a bucket using the management console. The IAM user I am using for debugging has full administrative access in the account.

我的创建存储桶调用是:

My create bucket call is:

let res = await s3.createBucket({
  Bucket: 'bucketname',
  CreateBucketConfiguration: { LocationConstraint: 'af-south-1' }
}).promise();

此功能适用于af-south-1以外的其他地区.

This works for regions other than af-south-1.

文档中,给出了位置限制的列表,该列表是否穷尽了所有可能的选择,还是仅列出了示例?

In the documentation, a list of location constraints is given, is this list exhaustive of all possible options, or just a list of examples?

是否可以使用sdk在af-south-1中创建存储桶,或者我做错了什么?

Is it possible to create a bucket in af-south-1 using the sdk, or am I doing something wrong?

这类似于此问题.

推荐答案

较新的AWS区域仅支持区域终结点.因此,如果在多个区域中创建存储桶,则如果您使用较新的区域之一,则需要为每个区域创建一个新的S3类实例:

Newer AWS regions only support regional endpoints. Thus, if creating buckets in more than one region, a new instance of the S3 class needs to be created for each of the regions if you are using one of the newer regions:

  const s3 = new AWS.S3({
    region: 'af-south-1',
  });

这篇关于InvalidLocationConstraint使用node.js aws-sdk在af-south-1(开普敦)区域中创建存储区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆