Error on EC2 Command Line Interface Tool Mac OS X

Just recently Amazon Web Services(AWS) has started offering AWS Certifications for Solutions Architect. I got excited of the thought of having a new certification under my belt so I jumped back to getting myself acquainted back to AWS. One of my first thing I needed to do was to get up to speed with the latest enhancements and tools.

First thing is there is a new method for setting up EC2 Command Line Interface(CLI) Tool, new method prefers the AWS_ACCESS_KEY and the AWS_SECRET_KEY, the old method is going to be deprecated in the future.

If you try adding the AWS_ACCESS_KEY and AWS_SECRET_KEY and then removed the EC2_PRIVATE_KEY and EC2_CERT on your setup environment(~/.bash_profile). When you run any ec2 command like


You might run into this error.

Required option '-K, --private-key KEY' missing (-h for usage)

Took me awhile to figure it out but the error is caused by an oudated CLI Tool. Since the old tool does not recognize the AWS_ACCESS_KEY and AWS_SECRET_KEY on your environment even if they are properly setup.

The quick solution is upgrade the CLI Tool and replace the bin and lib on your /.ec2 folder. That should be it. One post just for that simple solution. Hope somebody find that useful.

BTW major updates are coming soon for this site. I’ll redesigning it and be moving this blog to a nginx server soon to speed it up.

Leave a Reply

Your email address will not be published. Required fields are marked *