0
的加密拷貝我有以下紅寶石代碼:試圖創建一個AMI
sts = Aws::STS::Client.new
stsresp = sts.assume_role(
:role_arn => _role_arn,
:role_session_name => "provisioning_vpc_query"
)
ec2 = Aws::EC2::Client.new(
session_token: stsresp.credentials["session_token"],
region: _region,
access_key_id: stsresp.credentials["access_key_id"],
secret_access_key: stsresp.credentials["secret_access_key"]
)
# ...
p "got image: #{preimage_id}, create encrypted copy..."
resp = ec2.copy_image({
encrypted: true,
name: oname,
source_image_id: preimage_id,
source_region: _region,
dry_run: false
})
在上面的代碼,preimage_id是在上面提到的區域_region已知的圖像。
當我跑,我得到:
"got image: ami-71e9020b, create encrypted copy..."
Aws::EC2::Errors::InvalidRequest: The storage for the ami is not available in the source region.
我可以毫無問題控制檯手動執行此操作。
你能幫我弄清楚有什麼不對嗎?
也許'_region'包含無效值? –
更多可能的錯誤,https://forums.aws.amazon.com/thread.jspa?threadID=246931&tstart=0 – Kannaiyan