openssl rsa -in input_file -out output_file
I received this error when trying to copy files from an ec2 instance to an S3 bucket.
Credentials were checked, double and triple checked. The issue in my case was the aws cli version on the ec2 was too old.
To upgrade to the latest, carry out the instructions here:
1. Download the zip
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
The following fixed the issue on AWS EC2:
/root/.local/share/letsencrypt/bin/pip install --upgrade certbot
Install awscli locally. In this case with brew on a mac:
brew install awscli
Configure the cli:
AWS Access Key ID: IAM credential with necessary access
AWS Secret Access Key: IAM credential with necessary access
Default region name: e.g. eu-west-1
Default output format [None]: Leave as none
Now export all instances in this region to csv file:
aws ec2 describe-instances --output text --query 'Reservations[*].Instances[*].[InstanceId, InstanceType, ImageId, State.Name, LaunchTime, Placement.AvailabilityZone, Placement.Tenancy, PrivateIpAddress, PrivateDnsName, PublicDnsName, [Tags[?Key==`Name`].Value] , [Tags[?Key==`purpose`].Value] , [Tags[?Key==`environment`].Value] , [Tags[?Key==`team`].Value]  ]' > instances.csv