I’ve been primarily using Management Console to learn AWS basics. It’s tedious and slow at times but it works. To continue learning I’m considering switching to CLI.
How realistic (or advantageous) is it to use CLI instead of the Console?
Is AWS CLI the best option or are there 3rd party CLI solutions that are better?
What are some of the challenges or gotchas I should be aware of with CLI?
Even better to use Cloudformation or Terraform.
Regarding your question - no big diff between CLI and Management Console - all depends on case.
for example I often use aws s3 but ECS more convenient to check w/ Management Console.
If you’re trying to learn, a good thing to learn (and would help with this) is Terraform (or maybe CDK or Cloudformation). Any respectable shop is using an IaC tool to manage their infrastructure.
It’s very realistic. The CLI is powerful and, in some cases, the only way to do things. Last week I used the CLI to copy a 260gb file from S3 to an EC2 instance. It took ~two commands, whereas I don’t think it’s even possible from the console.
Terraform is not the CLI, it’s a third-party, infrastructure-as-code tool, similar to CloudFormation except open source. It’s not a substitute or replacement for the CLI.
If you’re familiar with PowerShell already the AWS Tools for PowerShell are pretty great; just not as up to date as the CLI for options sometimes (eg. enabling tags in Instance metadata).
If you want to use it in a production environment, I’d strongly recommend going with Gruntwork. They can get up and running with a multi-account setup and CI/CD fairly quickly. They’ve got excellent Terraform resources and modules for production uses.
Use something like Terraform for provisioning.
Use the management console for exploration and playing with new things.
Use the CLI for operations where you need to query complex information or large datasets about/from your environment.
Learning cli is pretty important. Scripting (with bash or Ruby or python) using cli will set you up for next steps with terraform or CDK. CDK is better, IMHO
Lately I found myself using the CLI way more often when I need to get something specific. For example management console for IAM has been a really terrible experience for me during last weeks. I have no idea whether they put out a new update or whatever but basically if I need to get some data, it’s way faster via the CLI with autocompletion than to click through a webpage (which of course shouldn’t be surprising at all). As a heavy CLI user, switching to AWS CLI for routine management has been very positive, it works superb. Especially with SSO support in v2.
Also as others said, if you’re learning and you’re thinking about managing your AWS account via the CLI, you should also really look into something like Terraform or AWS CDK rather than pulling up homemade scripts around AWS CLI or boto3. I’d be very hesitant and careful to let something 3rd party into my AWS account. It could be upfront malicious and cost you a pretty big load of money but it also can just simply contain more bugs than official tools would and hence lead to misconfiguration or also much bigger bills.
It’s doable and advisable. You’re basically going into infrastructure as code. This means your code is rerunnable. And it means you can recreate your AWS resources over and over again identically. This is important in case there are issues with the resource. Instead of spending hours figuring out what the issue is, you can just spin up a new instance.
It’s important to understand why the resource failed. But your time to resolution will be much faster.
Logging and observability are also crucial for cloud computing.
When learning AWS, you can click around the console. But this is only for learning. It has all kind of problems if you try to actually manage your account that way: How can your reproduce something? How can you un-do an accidental click? How do you know what was done and WHY you needed it? Oh, and you should have a staging account so you can test changes before doing them to production. How can you ensure you didn’t miss anything?
The answer is not the CLI, but IaC: Infrastructure as Code. In theory, CloudFormation – but AWS is quite slow at supporting their own language. Even better and more powerful is TerraForm. Your infrastructure should be just like your code: Pull Requests, Peer Review, CI testing (see Atlantis), deployed to your staging env (should be a different AWS account), then deployed to production, roll-back-able, and history with descriptions so you can “git blame” to find out why a change was done.
IF you’re using the CLI, it’s worth it to learn to use a json parser like JQ as well so that you can more easily filter your output. JQ is hard to master in my opinion (other than doing extremely trivial things with it) but mastering it will make figuring out only the values that you care about from a massive json blob per instance of an AWS resource extremely simple.