0

I am new to AWS. I wish to know -

  • how to configure AWS-CLI (setup access and secret keys) automatically by bootstrap the EC2 instance, such that when somebody logs into the running instance he gets the AWS CLI already configured automatically and can straight away start running commands using the cli
  • Also, if I create a custom AMI and configure AWS CLI on it, would all the instances that are derived from this custom AMI be getting the cli already configured ?

Any help will be appreciated.

marie20
  • 723
  • 11
  • 30
  • Rather than hard coding credentials, why not use [IAM roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html)? – Anon Coward May 19 '23 at 02:43
  • Which AMI are you using to launch your Amazon EC2 instance? If you are using Amazon Linux, then the AWS CLI is already installed. Also, when you say "can straight away start running commands using the cli", which credentials would you want them to use? Would it be different for every user? Are they logging into the instance with their own username, or as `ec2-user`? – John Rotenstein May 19 '23 at 03:20
  • @John thanks for your reply. I am using Ubuntu. The users will login to EC2 instances with their own ids, but the aws cli should be preconfigured using a specific `service- id` in the EC2 instances. All users who log in should be able to run aws cli commands which should be preconfigured using the service id. Also, if I create a custom AMI and configure AWS CLI on it, would all the instances that are derived from this custom AMI be getting the cli preconfigured ? – marie20 May 19 '23 at 09:28
  • What do you mean by `service-id`? What is it and how is it associated with a user? – John Rotenstein May 19 '23 at 10:21
  • well, by service-id i meant a generic process-id which is just another userid, and will be used to run the jobs in production. In prod we call service-ids as usernames. – marie20 May 22 '23 at 00:44

0 Answers0