Ways to use AWS — console, CLI, SDKs and infrastructure as code
Every action on AWS, whether starting a server or creating a bucket, is an API call: a request sent over HTTPS to an AWS service. The console, the command line and your own programs are simply different ways of sending those requests.
This topic covers how to reach AWS, when to automate, and where your workloads can run.
Ways to access AWS
| Way | What it is | Best for |
|---|---|---|
| AWS Management Console | The web interface, with forms and dashboards | Learning, exploring, one-off tasks, viewing billing |
| AWS CLI | A command-line tool that covers every service | Quick scripts and repeating tasks from a terminal |
| AWS SDKs | Libraries for languages such as Python, JavaScript, Java and Go | Applications that call AWS from their own code |
| APIs | The HTTPS endpoints that all the tools above use | Anything that needs direct control |
| Infrastructure as code (IaC) | Text templates that describe resources; AWS CloudFormation creates them | Building the same environment again and again |
For example, this AWS CLI command lists your S3 buckets:
aws s3 lsand this CloudFormation template creates a bucket:
Resources: ReportsBucket: Type: AWS::S3::BucketAll of these require credentials. People sign in to the console; programs and the CLI use access keys or, better, temporary credentials from roles (see IAM basics).
One-time task or repeatable process?
Clicking in the console is fine for a one-off check. When something must happen more than once, such as a test, staging and production copy of the same environment, use a repeatable process.
Infrastructure as code with CloudFormation gives you:
- Consistency: every environment is built exactly the same way, with no forgotten steps.
- Speed: a whole stack of resources (network, servers, database) is created in one go.
- Review and history: templates live in version control like application code.
- Clean-up: deleting a stack removes everything it created.
Scripts with the CLI or SDKs automate routine operations, such as nightly reports or cleanups.
Managed ways to deploy
Some services hide the infrastructure even more:
- AWS Elastic Beanstalk: upload your web application and it creates and manages the servers, load balancer and scaling for you.
- Amazon Lightsail: simple virtual servers, databases and websites for a predictable monthly price; good for small projects.
Deployment models: where workloads run
| Model | Where workloads run | Example |
|---|---|---|
| Cloud (all-in) | Entirely on AWS | A startup built on AWS from day one |
| Hybrid | Partly on AWS, partly in your own data center, connected together | An on-premises database with web servers on AWS, linked by AWS Direct Connect or a VPN |
| On-premises (private cloud) | In your own data center, with cloud-like tools | Workloads that must stay on site; AWS Outposts brings AWS hardware and services into your data center |
Hybrid is very common during migrations, and for companies that must keep some systems on site.
Putting it together: three environments
A team needs development, test and production environments that match exactly.
- Setting them up by hand in the console would take hours each time, and small differences would creep in.
- Instead they write one CloudFormation template and create three stacks from it. When they change the template, every environment can be updated the same way.
- Developers use the SDK inside the application to read files from S3, and the operations team uses the CLI for quick checks.
Common mix-ups
- CLI vs SDK. The CLI is a tool you type commands into; an SDK is a library your application code uses.
- Console vs IaC. The console is for exploring and one-offs; IaC is for anything you need to repeat reliably.
- Hybrid vs on-premises. Hybrid connects your data center and AWS; on-premises keeps everything in your data center.
Check yourself
A company must create identical environments in three Regions. What is the best approach?
Infrastructure as code with AWS CloudFormation: one template, deployed as a stack in each Region.
A developer’s Python application needs to upload files to S3. What should it use?
The AWS SDK for Python, using temporary credentials from an IAM role.
A company keeps a database in its own data center but runs web servers on AWS, connected by a private link. Which deployment model is that?
Hybrid.
Key takeaways
- The console, CLI, SDKs and IaC all make the same API calls in different ways.
- Use the console for one-off tasks and IaC or scripts for anything repeatable.
- Deployment models: cloud, hybrid and on-premises; Outposts brings AWS on premises.
Cloud Study Lab is an independent study site. It is not affiliated with or endorsed by Amazon Web Services. AWS and the names of AWS certifications are trademarks of Amazon.com, Inc. or its affiliates.