我的.ova
虚拟机存储在我的S3桶中,我正在尝试从这些OVA创建AMI。我正在浏览这视频,使用VM导入/导出到亚马逊EC2,将VM导入为图像。
我已经创建了一个EC2实例,我将使用它来触发导入所需的CLI命令。我创建了一个IAM角色,并将其附加到EC2实例中。
请参阅该角色的详细情况:
信任策略
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "vmie.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
内联策略用于访问S3和EC2
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:CopySnapshot",
"s3:ListAccessPointsForObjectLambda",
"s3:GetAccessPoint",
"s3:PutAccountPublicAccessBlock",
"s3:ListAccessPoints",
"ec2:RegisterImage",
"s3:ListJobs",
"s3:PutStorageLensConfiguration",
"s3:ListMultiRegionAccessPoints",
"s3:ListStorageLensConfigurations",
"ec2:Describe*",
"s3:GetAccountPublicAccessBlock",
"ec2:ModifySnapshotAttribute",
"s3:ListAllMyBuckets",
"s3:PutAccessPointPublicAccessBlock",
"s3:CreateJob",
"ec2:ImportImage"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "s3:*",
"Resource": "arn:aws:s3:::vms"
},
{
"Sid": "AllowStsDecode",
"Effect": "Allow",
"Action": "sts:DecodeAuthorizationMessage",
"Resource": "*"
}
]
}
用于KMS解密的内联策略
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "kms:Decrypt",
"Resource": "*"
}
]
}
此外,我还将AWSImportExportFullAccess
管理策略附加到角色中。
我使用以下命令将VM导入AMI:
aws ec2 import-image --description "MY_VM_Image" --disk-containers "file://configuration.json"
以下是configuration.json
的内容
[{
"Description": "Image",
"Format": "ova",
"UserBucket": {
"S3Bucket": "vm",
"S3Key": "xzt.ova"
}
}
]
但我面临以下错误:
An error occurred (InvalidParameter) when calling the ImportImage operation: The service role vmimport provided does not exist or does not have sufficient permissions
我试着看一下文档的故障排除。它说明如下:
This error can also occur if the user calling ImportImage has Decrypt permission but the vmimport role does not.
因此,我还禁用了S3的默认加密。
还是没有运气。要成功运行该命令,还需要哪些权限。
https://stackoverflow.com/questions/71364285
复制相似问题