banksiaboy
(Peter Goodall)
September 23, 2017, 6:44am
1
When I run aws-start
, I get this error:
An error occurred (InvalidInstanceID.Malformed) when calling the StartInstances operation: Invalid id: "“i-0972dcf72eaa51586"” (expecting “i-…”)
The value of the exported environment variable from aws-get-p2
is quoted, which may be the problem.
echo $instanceId
"i-0972dcf72eaa51586"
–Peter G
pflood
(Padraic Flood)
September 26, 2017, 7:55pm
2
I had the same problem. When I ran “aws configure” I forgot to set output type to “text”. Fixing this got rid of the quotes.
danielfr3
(Daniel Freire)
November 4, 2017, 2:00am
3
How you got rid of the quotes?
jvc26
(James Clemence)
November 5, 2017, 10:11am
4
While switching output type from aws configure
will achieve this, you could also get rid of the quotes by piping the output from the aws cli through tr
:
For example:
alias aws-get-p2='export instanceId=`aws ec2 describe-instances --filters "Name=instance-state-name,Values=stopped,Name=instance-type,Values=p2.xlarge" --query "Reservations[0].Instances[0].InstanceId" | tr -d \"\"\"` && echo $instanceId'
1 Like