Neil Kuan
December 16, 2020

Introducing AWS CloudShell !!!

Posted on December 16, 2020  •  2 minutes  • 419 words

AWS CloudShell

AWS 在 re:Invent 2020 <strong>Werner Vogels Keynote</strong> 中宣佈了

AWS CloudShell

source blog: https://aws.amazon.com/tw/blogs/aws/aws-cloudshell-command-line-access-to-aws-resources/

特色如下: Browser-based shell

Issue AWS Command Line Interface (AWS CLI) commands, run scripts, access common command line utilities including PowerShell and Bash, and use other popular AWS CLIs, such as the Amazon ECS CLI and the AWS SAM CLI, to interact with your AWS resources – all without leaving your web browser. (只能說繼GCP CloudShell, Azure CloudShell等類似服務後,AWS終於追上?!,你可以透過browser-based shell , 在上面執行 一些日常的維護 ,快速修復生產環境,甚至嘗試一些新的AWS服務或功能,我也有嘗試安裝cdk 並進行deploy) https://twitter.com/neil_kuan/status/1338912912690225152

https://twitter.com/neil_kuan/status/1338912912690225152

Familiar tools

CloudShell runs on Amazon Linux 2 and contains common AWS command line interfaces, including AWS CLI, Amazon Elastic Container Service (Amazon ECS) CLI, AWS Serverless Application Model (AWS SAM) CLI, along with runtimes and AWS SDKs for Python and Node.js. Other commonly used command line utilities for shells (Bash, PowerShell, Zsh), editors (vi), source control (Git), and package management (npm, pip) are also installed. For a complete list of pre-installed tools, see the AWS CloudShell User Guide .

預先裝好 aws cli , npm 等等… Amazon Linux 2 為基底 這意味著你可以 sudo yum 安裝套件…

Automatically manages your credentials

CloudShell inherits the credentials of the user who is signed in to the AWS Management Console. This makes authentication simpler and reduces operational burden by eliminating the need to configure and manage credentials locally.

當你 aws console login 的token 自動繼承到CloudShell 上面 try: aws sts get-caller-identity 得到的結果應該會跟你console login 的iam user 相同(assumeRole 也是一樣喔)

Fully managed and up-to-date

CloudShell is fully managed, including the latest security patches and latest versions of the operating system and the installed tools. You can focus on building and managing your AWS resources instead of maintaining your local machines or software tooling.

CloudShell是全拖管的服務,包括最新的安全補丁,最新版本的操作系統和已安裝的工具。 您可以專注於構建和管理您的AWS資源,而不用維護本地機器或軟件工具。

1 GB of persistent storage

CloudShell comes with 1 GB of persistent storage for your home directory. Persistent storage enables you to store your frequently used scripts and configuration files between CloudShell sessions. For more details on persistent storage, see the AWS CloudShell User Guide.

官方手冊 描述著 可以有 1GiB的家目錄 持久存儲空間,1 vCPU , 2 Gib RAM (但我實際下指令查詢是2 cpu, 4 Gib RAM 待確認)

Getting start

step 0: 你使用的身份需要有 **AWSCloudShellFullAccess** policy attach

step 1 : 點選 看起來像 terminal 的圖示(目前support region: CloudShell is available today in the US East (N. Virginia), US East (Ohio), US West (Oregon), Europe (Ireland), and Asia Pacific (Tokyo) Regions, with the remaining regions on the near-term roadmap.)

step2: 第一次啟用需要一點時間

可以使用以下指令查看aws cli 版本

$ aws --version 

可以使用以下指令查看 當前身份

$ aws sts get-caller-identity 

就可以開始你的 工作了

是不是相當快速簡單啊


說了這麼多 來試一下我寫的 shell script 讓你裝一下 炫炫的特效

$ curl -s https://gist.githubusercontent.com/neilkuan/f48394a1e68dcebe99272889753a5d06/raw/fc91a6f2d97bf9b13a4185d74a925870c22ba9c9/cloudshell-lolbanner.sh | bash
https://gist.github.com/f48394a1e68dcebe99272889753a5d06.git

see more cloudshell docs: https://docs.aws.amazon.com/cloudshell/latest/userguide/welcome.html

20201216 Neil Kuan

Follow me

Here's where I hang out in social media