Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use AWS CLI and EB CLI

For a month or so, I've been studying AWS services and now I have to accomplish some basic stuff on AWS elastic beanstalk via command line. As far as I understand there are the aws elasticbeanstalk [command] and the eb [command] CLI installed on the build instance.

When I run eb status inside application folder, I get response in the form:

Environment details for: app-name
Application name: app-name
Region: us-east-1
Deployed Version: app-version
Environment ID: env-name
Platform: 64bit Amazon Linux ........
Tier: WebServer-Standard
CNAME: app-name.elasticbeanstalk.com
Updated: 2016-07-14 .......
Status: Ready
Health: Green

That tells me eb init has been run for the application.

On the other hand if I run:

aws elasticbeanstalk describe-application-versions --application-name app-name --region us-east-1

I get the error:

Unable to locate credentials. You can configure credentials by running "aws configure".

In home folder of current user there is a .aws directory with a credential file containing a [profile] line and aws_access_key_id and aws_secret_access_key lines all set up.

Beside the obvious problem with the credentials, what I really lack is understanding of the two cli. Why is EB cli not asking for credentials and AWS cli is? When do I use one or the other? Can I use only aws cli? Any clarification on the matter will be highly appreciated.

EDIT:

For anyone ending up here, having the same problem with "Unable to locate credentials". Adding --profile profile-name option solved the problem for me. profile-name can be found in ~/.aws/config (or credentials) file on [profile profile-name] line.

like image 586
ERIK_SON Avatar asked Jul 15 '16 07:07

ERIK_SON


People also ask

What is EB CLI AWS?

The EB CLI is a command line interface for AWS Elastic Beanstalk that provides interactive commands that simplify creating, updating and monitoring environments from a local repository. Use the EB CLI as part of your everyday development and testing cycle as an alternative to the Elastic Beanstalk console.

What is the difference between EC2 and Elastic Beanstalk?

EC2 is Amazon's service that allows you to create a server (AWS calls these instances) in the AWS cloud. You pay by the hour and only what you use. You can do whatever you want with this instance as well as launch n number of instances. Elastic Beanstalk is one layer of abstraction away from the EC2 layer.

What is the difference between CloudFormation and Elastic Beanstalk?

The essential difference between these services is that Beanstalk handles deployment/provisioning for you while CloudFormation requires a lot of input. So one's low effort, low control, and vice versa.

What is the difference between Elastic Beanstalk and lambda?

Lambda can handle infrequent, asynchronous code, such as event handlers that call other cloud services for heavy-duty processing, while Elastic Beanstalk underpins how developers build, deploy and manage the custom back-end services for the application.


2 Answers

In order to verify that the AWS CLI is configured on your system run aws configure and provide it with all the details it requires. That should fix your credentials problem and checking the change in configuration will allow you to understand what's wrong with your current conf.

the eb cli and the aws cli have very similar capabilities, and I too am a bit confused as to why they both should exist. From my experience the main differences are that the cli is used to interact with your AWS account using simple requests while the eb cli creates connections between you and the eb envs and so allows for finer control over them.

For instance - I've just developed a CI/CD pipeline for our beanstalk apps. When I use the eb cli I can monitor the deployment of our apps and notify the developers when it's finished. aws cli does not offer that functionality, and the only to achieve that is to repeatedly query the service until you receive the desired result.

like image 190
Yaron Idan Avatar answered Sep 22 '22 02:09

Yaron Idan


The AWS CLI is a general tool that works on all AWS resources. It's not tied to a specific software project, the type of machine you're on, the directory you're in, or anything like that. It only needs credentials, whether they've been put there manually if it's your own machine, or generated by AWS if it's an EC2 instance.

The EB CLI is a high level tool to wrangle your software project into place. It's tied to the directory you're in, it assumes that the stuff in your directory is your project, and it has short commands that do a lot of background work to magically put everything in the right place.

like image 35
snetch Avatar answered Sep 19 '22 02:09

snetch