1 Answer
- Newest
- Most votes
- Most comments
1
Your access key and secret access key are used to talk to AWS APIs as the IAM user you created them for. There is no username for an access key. They are unique to the user you created them for, and when you use them AWS knows who you are. This page of the general documentation might clear things up for you.
It sounds like you're trying to connect to an EC2 instance. In the case of Ubuntu, you need SSH to the server using a SSH key pair (public and private key file) that you generate when you start the instance. See the EC2 documentation for more details about instance keypairs, and how to SSH to an instance.
answered 3 years ago
Relevant content
- asked a year ago
- asked 4 months ago
- asked 4 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
Can you share any information about how you're trying to configure the AWS CLI? If you just run
aws configure
it will prompt for your Access Key ID and Secret Access Key (which are in the CSV file), plus your desired default region and output format. You don't need to supply any username for the CLI, all it needs to work are the two values in the CSV file.Just re-reading your question; where are you trying to configure the CLI and what are you trying to do with it?
If you want to have credentials inside the EC2 instance for use there, it's a best practice to use an instance profile instead of static credentials: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html
If you want to use the AWS CLI on your local Ubuntu machine to call AWS APIs to control your instance (e.g. start/stop), then you should use the step in my first comment.
I'm using ubuntu bash shell which has aws installed. When I try to import the csv file containing my access key and secret, it gives an error saying that csv file doesn't have username in it. Also when I manually configured the secret key method in aws cli console, I don't know what command to use to entire my ec2 instance after that.
As for other methods of entering into my ubuntu ec2 instance, I really have tired of reading all help aws help documents and trying to use 'Ssh keys' generation method. When I save the pem or ppk public key to my local client pc and try to ssh to ec2 instance, my public key is rejected.
Also tried 'connect' option of Ec2, in website console, it gives 'Unknown error'.
In short, there is no way successful to connect (or enter into) my ec2 instance. Only oceans of aws documentation exist.
Per the answer posted below, if you're just trying to log in to your EC2 instance, you don't use the AWS CLI for that. You should be able to connect using the .pem it sounds like you're downloading (assuming that's the one specified when launching the instance). You will probably need to
chmod 400
it as ssh will refuse to use a key file with too-broad permissions. Finally, make sure to connect using the right username; Amazon Linux usesec2-user
, I think Ubuntu usesubuntu
.