Getting error asking for unknow parameter while importing ova image to aws following official ducumentation.
I need deploy my current basic Debian box fully baked to AWS with all configurations and softwares thats is already running here on my production.
The documentation is at: vmimport-image
When asking for help on command line its the almost same possible parameters list:
aws ec2 import-image help
[--architecture <value>]
[--client-data <value>]
[--client-token <value>]
[--description <value>]
[--disk-containers <value>]
[--dry-run | --no-dry-run]
[--encrypted | --no-encrypted]
[--hypervisor <value>]
[--kms-key-id <value>]
[--license-type <value>]
[--platform <value>]
[--role-name <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
The commands itself im putting on terminal:
# It is the 'first one' referred below
cfgAmi=$(cat <<'EOF'
[
{
"Description": "mySystem",
"Format": "ova",
"UserBucket": {
"S3Bucket": "mySystemBucket",
"S3Key": "mySystem.ova"
}
}
]
EOF
)
When using the flag dry-run to test it tell (Request would have succeeded, but DryRun flag is set):
echo $cfgAmi | aws ec2 import-image \
--dry-run \
--description "mySystem" \
--architecture x86_64 \
--hypervisor xen \
--platform Linux \
--role-name root \
--disk-containers
But when runnig the command to really take the action:
echo $cfgAmi | aws ec2 import-image \
--description "mySystem" \
--architecture x86_64 \
--hypervisor xen \
--platform Linux \
--role-name root \
--disk-containers
The error message:
An error occurred (InvalidParameter) when
calling the ImportImage operation:
Missing required parameter (disk-images)
The disk-images
it ask for isn't even a possible parameter.
The UserBucket
key above isnt on terminal based help but is on the html documentation I told above.
The error remains the same when, following one unofficial article I found, updated configuration above to:
# run again the 'first one' to
# populate $cfgAmi variable then:
cfgAmi=$(cat <<EOF
{
"Description": "mySystem",
"DiskContainers": $cfgAmi
}
EOF
)
or
# run again the 'first one' to
# populate $cfgAmi variable then:
cfgAmi=$(cat <<EOF
{
"description": "mySystem",
"disk-containers": $cfgAmi
}
EOF
)
For any of both above, if on this point I change the execution command to :
aws ec2 import-image --cli-input-json $cfgAmi
I get the error:
Unknown options: \
"mySystem",, \
"disk-containers":, \
[, {, "Description":, \
"mySystem",, "Format":, \
"ova",, "UserBucket":, \
{, "S3Bucket":, "mySystemBucket",, \
"S3Key":, "mySystem.ova", \
}, }, ], }, "description":
When using:
aws ec2 import-image --cli-input-json "{
\"description\": \"mySystem\",
\"disk-containers\": [ {
\"Description\": \"mySystem\",
\"Format\": \"ova\",
\"UserBucket\": {
\"S3Bucket\": \"mySystemBucket\",
\"S3Key\": \"mySystem.ova\"
}
} ]
}"
Get the error:
Unknown parameter in input:
"disk-containers", must be one of:
Architecture, ClientData, ClientToken,
Description, DiskContainers, DryRun,
Encrypted, Hypervisor, KmsKeyId,
LicenseType, Platform, RoleName
Unknown parameter in input:
"description", must be one of:
Architecture, ClientData, ClientToken,
Description, DiskContainers, DryRun,
Encrypted, Hypervisor, KmsKeyId,
LicenseType, Platform, RoleName
But when using:
cfgAmi=$(cat <<'EOF'
"[
{
'Description': 'mySystem',
'Format': 'ova',
'UserBucket': {
'S3Bucket': 'mySystemBucket',
'S3Key': 'mySystem.ova'
}
}
]"
EOF
)
echo $cfgAmi | aws ec2 import-image \
--Architecture x86_64 \
--Description "mySystem" \
--Hypervisor xen \
--LicenseType Auto \
--platform Linux \
--RoleName root \
--DiskContainers
Return the error:
Unknown options: \
--Architecture, \
--Description, \
mySystem, \
--Hypervisor, \
xen, \
--LicenseType, \
Auto, \
--RoleName, \
root, \
--DiskContainers, \
x86_64
And when doing:
aws ec2 import-image \
--Architecture x86_64 \
--Description "mySystem" \
--Hypervisor xen \
--LicenseType Auto \
--platform Linux \
--RoleName root \
--DiskContainers "[ {
'Description': 'mySystem',
'Format': 'ova',
'UserBucket': {
'S3Bucket': 'mySystemBucket',
'S3Key': 'mySystem.ova'
}
} ]"
There is the error:
Unknown options: \
--Architecture, \
--Description, \
mySystem, \
--Hypervisor, \
xen, \
--LicenseType, \
Auto, \
--RoleName, \
root, \
--DiskContainers, \
[ { 'Description': 'mySystem',
'Format': 'ova', 'UserBucket': {
'S3Bucket': 'mySystemBucket',
'S3Key': 'mySystem.ova'
} } ], x86_64
When I uploaded the same machine as vmdk and tried do the same process with the another format as follow:
aws ec2 import-image \
--Architecture x86_64 \
--Description "mysystem" \
--Hypervisor xen \
--LicenseType Auto \
--platform Linux \
--RoleName root \
--DiskContainers "[ {
'Description': 'mysystem',
'Format': 'vmdk',
'UserBucket': {
'S3Bucket': 'mySystemBucket',
'S3Key': 'mysystem.vmdk'
}
} ]"
Receive the error:
Unknown options: \
--Architecture, \
--Description, \
mysystem, \
--Hypervisor, \
xen, \
--LicenseType, \
Auto, \
--RoleName, \
root, \
--DiskContainers, [ {
'Description': 'mysystem',
'Format': 'vmdk',
'UserBucket': {
'S3Bucket': 'mySystemBucket', \
'S3Key': 'mysystem.vmdk'
}
} ], \
x86_64
Some articles telling to use:
Aminator from Netflix but it works by taking an existing AMI and tweaking it until fit the need to then upload again but we need upload our server as a full box, its a simple default Debian box already running on our production and full with our systems that we have here, many of these systems just cant be reinstalled on another box for various reasons and if it was possible we wont bother with custom AMI we would just up a default AWS instance with the simpliest Debian AMI and install all there again.
Packer from Hashicorp have many builders, the AMI Builder (instance-store) ask for a tool named AMI Tools that you need download from Amazon and I just listened about now and it turn all even more confuse because the AWS docs dont tell about it while telling how to deploy a local machine as EC2, Packer also, as Aminator, need a base AWS AMI to work above and dont export an local default Debian image, it ask for source_ami that it the initial AMI used as a base for the newly created machine.