2020年12月18日ローンチ「AWS CloudShell – AWS リソースへのコマンドラインアクセス」やってみた

# 概要

AWS CloudShell – AWS リソースへのコマンドラインアクセス
https://aws.amazon.com/jp/blogs/news/aws-cloudshell-command-line-access-to-aws-resources/

2020年12月18日ローンチされた突然コンソールに現れたボタン
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/188544/0832bf4c-5861-3caa-fe7f-7543355ceb63.png)
が気になって、やってみました。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/188544/e5570210-af29-3ca1-9cc0-bdfdaba335bd.png)
便利。AWS CLIをちょっとだけ試したい時に無料でサクッと試せるようになりました。

```sh
[cloudshell-user@ip-XX-XX-XX-XX ~]$ aws --version
aws-cli/2.2.15 Python/3.8.8 Linux/4.14.243-185.433.amzn2.x86_64 exec-env/CloudShell exe/x86_64.amzn.2 prompt/off
[cloudshell-user@ip-XX-XX-XX-XX ~]$
```

## できるようになること

* ブラウザベースでAWS CLI/Pythonなど手軽に試せる

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/188544/bb7dba63-933c-70d5-a1cc-0e0a807dfe60.png)
ボタン押下後、初回のみ環境を作るようで時間がかかりました。でも1分程度。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/188544/e5570210-af29-3ca1-9cc0-bdfdaba335bd.png)

* 料金は各リージョンで最大 10 個のシェルを同時に**無料**で使用可能
    * てっきりCloud9のように内部的にはEC2が立ち上がってその分料金がかかりますよ。と思ったらEC2は立ち上がらず10 個まで無料とのこと。
    * CloudShell とともに使用する他の AWS リソースに対してのみお支払い。とのこと。それはそうか。


* ログインできる任意の IAM プリンシパルを介して、シェルにアクセス

```sh
[cloudshell-user@ip-XX-XX-XX-XX ~]$ aws sts get-caller-identity
{
    "UserId": "XXXXXXXXXXXXXXXXXXXXXX",
    "Account": "xxxxxxxxxxxx",
    "Arn": "arn:aws:iam::xxxxxxxxxxxx:user/User01"
}
[cloudshell-user@ip-XX-XX-XX-XX ~]$
```
なるほどなるほど。AWSコンソール ログインユーザですね。

* ファイルをシェル環境からデスクトップにダウンロードし、デスクトップからシェルにアップロードすることも可能
* ホームディレクトリにはリージョンごとに最大 1 GB のファイルを保存でき、そのリージョンでシェルを開くたびに利用可能
    * 後日、CloudShell起動してみると確かにファイルは残っていました

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/188544/fad7040a-7035-220c-58aa-e370c5809442.png)

* Python およびノードランタイムに加えて、Bash、PowerShell、jq、git、ECS CLI、SAM CLI、npm、pip は既にインストール済で利用可能

```sh
[cloudshell-user@ip-XX-XX-XX-XX ~]$ rpm -qa
ncurses-libs-6.0-8.20170212.amzn2.1.3.x86_64
pcre-8.32-17.amzn2.0.2.x86_64
bzip2-libs-1.0.6-13.amzn2.0.2.x86_64
elfutils-libelf-0.176-2.amzn2.x86_64
libacl-2.2.51-14.amzn2.x86_64
sqlite-3.7.17-8.amzn2.1.1.x86_64
keyutils-libs-1.5.8-3.amzn2.0.2.x86_64
gdbm-1.13-6.amzn2.0.2.x86_64
gawk-4.0.2-4.amzn2.1.2.x86_64
gmp-6.0.0-15.amzn2.0.2.x86_64
krb5-libs-1.15.1-37.amzn2.2.2.x86_64
pyliblzma-0.5.3-11.amzn2.0.2.x86_64
cyrus-sasl-lib-2.1.26-23.amzn2.x86_64
shared-mime-info-1.8-4.amzn2.x86_64
gnupg2-2.0.22-5.amzn2.0.4.x86_64
pygpgme-0.3-9.amzn2.0.2.x86_64
yum-plugin-ovl-1.1.31-46.amzn2.0.1.noarch
ncurses-base-6.0-8.20170212.amzn2.1.3.noarch
basesystem-10.0-7.amzn2.0.1.noarch
info-5.1-5.amzn2.x86_64
xz-libs-5.2.2-1.amzn2.0.2.x86_64
lua-5.1.4-15.amzn2.0.2.x86_64
libattr-2.4.46-12.amzn2.0.2.x86_64
chkconfig-1.7.4-1.amzn2.0.2.x86_64
grep-2.20-3.amzn2.0.2.x86_64
libgcrypt-1.5.3-14.amzn2.0.2.x86_64
findutils-4.5.11-6.amzn2.x86_64
libidn2-2.3.0-1.amzn2.x86_64
libtasn1-4.10-1.amzn2.0.2.x86_64
coreutils-8.22-24.amzn2.x86_64
gpgme-1.3.2-5.amzn2.0.2.x86_64
vim-minimal-8.1.1602-1.amzn2.x86_64
bash-4.2.46-34.amzn2.x86_64
glibc-common-2.26-37.amzn2.x86_64
p11-kit-0.23.21-2.amzn2.0.1.x86_64
expat-2.1.0-12.amzn2.x86_64
libmetalink-0.1.3-13.amzn2.x86_64
libcrypt-2.26-37.amzn2.x86_64
python-2.7.18-1.amzn2.0.2.x86_64
cpio-2.11-28.amzn2.x86_64
libnghttp2-1.41.0-1.amzn2.x86_64
curl-7.61.1-12.amzn2.0.2.x86_64
rpm-4.11.3-40.amzn2.0.5.x86_64
rpm-build-libs-4.11.3-40.amzn2.0.5.x86_64
system-release-2-12.amzn2.x86_64
yum-3.4.3-158.amzn2.0.4.noarch
libxml2-2.9.1-6.amzn2.5.1.x86_64
nodejs-12.18.4-1nodesource.x86_64
gzip-1.5-10.amzn2.x86_64
wget-1.14-18.amzn2.1.x86_64
unzip-6.0-21.amzn2.x86_64
libcap-ng-0.7.5-4.amzn2.0.4.x86_64
cracklib-2.9.0-11.amzn2.0.2.x86_64
groff-base-1.22.2-8.amzn2.0.2.x86_64
less-458-9.amzn2.0.2.x86_64
perl-parent-0.225-244.amzn2.0.1.noarch
perl-Pod-Perldoc-3.20-4.amzn2.noarch
perl-Text-ParseWords-3.29-4.amzn2.noarch
perl-Pod-Escapes-1.04-294.amzn2.noarch
perl-Filter-1.49-3.amzn2.0.2.x86_64
perl-constant-1.27-2.amzn2.0.1.noarch
perl-threads-shared-1.43-6.amzn2.0.2.x86_64
perl-PathTools-3.40-5.amzn2.0.2.x86_64
perl-Socket-2.010-4.amzn2.0.2.x86_64
perl-libs-5.16.3-294.amzn2.x86_64
perl-File-Path-2.09-2.amzn2.noarch
perl-Getopt-Long-2.40-3.amzn2.noarch
perl-Exporter-5.68-3.amzn2.noarch
perl-TermReadKey-2.30-20.amzn2.0.2.x86_64
libpwquality-1.2.3-5.amzn2.x86_64
fipscheck-lib-1.4.1-6.amzn2.0.2.x86_64
acl-2.2.51-14.amzn2.x86_64
ustr-1.0.4-16.amzn2.0.3.x86_64
shadow-utils-4.1.5.1-24.amzn2.0.2.x86_64
pcre2-10.23-2.amzn2.0.2.x86_64
libsmartcols-2.30.2-2.amzn2.0.4.x86_64
qrencode-libs-3.4.1-3.amzn2.0.2.x86_64
device-mapper-1.02.146-4.amzn2.0.2.x86_64
cryptsetup-libs-1.7.4-4.amzn2.x86_64
systemd-libs-219-57.amzn2.0.12.x86_64
systemd-219-57.amzn2.0.12.x86_64
dbus-1.10.24-7.amzn2.x86_64
emacs-filesystem-25.3-3.amzn2.0.2.noarch
openssh-clients-7.4p1-21.amzn2.0.1.x86_64
git-core-doc-2.23.3-1.amzn2.0.1.noarch
perl-Git-2.23.3-1.amzn2.0.1.noarch
sudo-1.8.23-4.amzn2.2.x86_64
tmux-1.8-4.amzn2.0.1.x86_64
jq-1.5-1.amzn2.0.2.x86_64
python3-pip-9.0.3-1.amzn2.0.2.noarch
python3-3.7.9-1.amzn2.0.1.x86_64
mariadb-libs-5.5.68-1.amzn2.x86_64
make-3.82-24.amzn2.x86_64
man-db-2.6.3-9.amzn2.0.3.x86_64
vim-filesystem-8.1.1602-1.amzn2.noarch
gpm-libs-1.20.7-15.amzn2.0.2.x86_64
vim-enhanced-8.1.1602-1.amzn2.x86_64
libicu-50.2-4.amzn2.x86_64
nspr-4.25.0-2.amzn2.x86_64
nss-softokn-freebl-3.53.1-6.amzn2.x86_64
nss-sysinit-3.53.1-3.amzn2.x86_64
nss-tools-3.53.1-3.amzn2.x86_64
glib2-2.56.1-7.amzn2.0.1.x86_64
filesystem-3.2-25.amzn2.0.4.x86_64
libsepol-2.5-8.1.amzn2.0.2.x86_64
zlib-1.2.7-18.amzn2.x86_64
libdb-5.3.21-24.amzn2.0.3.x86_64
popt-1.13-16.amzn2.0.2.x86_64
libffi-3.0.13-18.amzn2.0.2.x86_64
libgpg-error-1.12-3.amzn2.0.3.x86_64
sed-4.2.2-5.amzn2.0.2.x86_64
libuuid-2.30.2-2.amzn2.0.4.x86_64
pinentry-0.8.1-17.amzn2.0.2.x86_64
libunistring-0.9.3-9.amzn2.0.2.x86_64
pth-2.0.7-23.amzn2.0.2.x86_64
libverto-0.2.5-4.amzn2.0.2.x86_64
python-iniparse-0.4-9.amzn2.noarch
libmount-2.30.2-2.amzn2.0.4.x86_64
python-urlgrabber-3.10-9.amzn2.0.1.noarch
gpg-pubkey-c87f5b1a-593863f8
setup-2.8.71-10.amzn2.0.1.noarch
libselinux-2.5-12.amzn2.0.2.x86_64
readline-6.2-10.amzn2.0.2.x86_64
libcap-2.22-9.amzn2.0.2.x86_64
libassuan-2.1.0-3.amzn2.0.2.x86_64
libdb-utils-5.3.21-24.amzn2.0.3.x86_64
diffutils-3.3-5.amzn2.x86_64
ncurses-6.0-8.20170212.amzn2.1.3.x86_64
pyxattr-0.5.1-5.amzn2.0.2.x86_64
nss-pem-1.0.3-5.amzn2.x86_64
libblkid-2.30.2-2.amzn2.0.4.x86_64
yum-metadata-parser-1.1.4-10.amzn2.0.2.x86_64
python-pycurl-7.19.0-19.amzn2.0.2.x86_64
yum-plugin-priorities-1.1.31-46.amzn2.0.1.noarch
tzdata-2020a-1.amzn2.noarch
glibc-minimal-langpack-2.26-37.amzn2.x86_64
glibc-2.26-37.amzn2.x86_64
file-libs-5.11-36.amzn2.0.1.x86_64
libgcc-7.3.1-9.amzn2.x86_64
p11-kit-trust-0.23.21-2.amzn2.0.1.x86_64
python-libs-2.7.18-1.amzn2.0.2.x86_64
libcom_err-1.42.9-19.amzn2.x86_64
libssh2-1.4.3-12.amzn2.2.3.x86_64
libcurl-7.61.1-12.amzn2.0.2.x86_64
rpm-libs-4.11.3-40.amzn2.0.5.x86_64
openldap-2.4.44-22.amzn2.x86_64
python2-rpm-4.11.3-40.amzn2.0.5.x86_64
amazon-linux-extras-1.6.12-1.amzn2.noarch
ca-certificates-2019.2.32-76.amzn2.0.3.noarch
libstdc++-7.3.1-9.amzn2.x86_64
glibc-langpack-en-2.26-37.amzn2.x86_64
tar-1.26-35.amzn2.x86_64
libidn-1.28-4.amzn2.0.2.x86_64
zip-3.0-11.amzn2.0.2.x86_64
zsh-5.7.1-6.amzn2.0.1.x86_64
audit-libs-2.8.1-3.amzn2.1.x86_64
cracklib-dicts-2.9.0-11.amzn2.0.2.x86_64
lz4-1.7.5-2.amzn2.0.1.x86_64
perl-HTTP-Tiny-0.033-3.amzn2.noarch
perl-podlators-2.5.1-3.amzn2.0.1.noarch
perl-Encode-2.51-7.amzn2.0.2.x86_64
perl-Pod-Usage-1.63-3.amzn2.noarch
perl-macros-5.16.3-294.amzn2.x86_64
perl-Time-Local-1.2300-2.amzn2.noarch
perl-Scalar-List-Utils-1.27-248.amzn2.0.2.x86_64
perl-threads-1.87-4.amzn2.0.2.x86_64
perl-Time-HiRes-1.9725-3.amzn2.0.2.x86_64
perl-Carp-1.26-244.amzn2.noarch
perl-File-Temp-0.23.01-3.amzn2.noarch
perl-Storable-2.45-3.amzn2.0.2.x86_64
perl-Pod-Simple-3.28-4.amzn2.noarch
perl-5.16.3-294.amzn2.x86_64
perl-Error-0.17020-2.amzn2.noarch
pam-1.1.8-23.amzn2.0.1.x86_64
fipscheck-1.4.1-6.amzn2.0.2.x86_64
kmod-25-3.amzn2.0.2.x86_64
libsemanage-2.5-11.amzn2.x86_64
libutempter-1.1.6-4.amzn2.0.2.x86_64
libfdisk-2.30.2-2.amzn2.0.4.x86_64
kmod-libs-25-3.amzn2.0.2.x86_64
util-linux-2.30.2-2.amzn2.0.4.x86_64
device-mapper-libs-1.02.146-4.amzn2.0.2.x86_64
elfutils-libs-0.176-2.amzn2.x86_64
dbus-libs-1.10.24-7.amzn2.x86_64
elfutils-default-yama-scope-0.176-2.amzn2.noarch
openssh-7.4p1-21.amzn2.0.1.x86_64
libedit-3.0-12.20121213cvs.amzn2.0.2.x86_64
git-core-2.23.3-1.amzn2.0.1.x86_64
libsecret-0.18.5-2.amzn2.0.2.x86_64
git-2.23.3-1.amzn2.0.1.x86_64
libevent-2.0.21-4.amzn2.0.3.x86_64
libtirpc-0.2.4-0.16.amzn2.x86_64
python3-libs-3.7.9-1.amzn2.0.1.x86_64
python3-setuptools-38.4.0-3.amzn2.0.6.noarch
mariadb-5.5.68-1.amzn2.x86_64
libpipeline-1.2.3-3.amzn2.0.2.x86_64
procps-ng-3.3.10-26.amzn2.x86_64
vim-common-8.1.1602-1.amzn2.x86_64
which-2.20-7.amzn2.0.2.x86_64
iputils-20160308-10.amzn2.0.2.x86_64
powershell-7.0.3-1.rhel.7.x86_64
nss-util-3.53.1-1.amzn2.x86_64
nss-softokn-3.53.1-6.amzn2.x86_64
nss-3.53.1-3.amzn2.x86_64
oniguruma-5.9.6-1.amzn2.0.4.x86_64
openssl-libs-1.0.2k-19.amzn2.0.4.x86_64

[cloudshell-user@ip-XX-XX-XX-XX ~]$ yum list installed
Loaded plugins: ovl, priorities
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/Conflictname'
Installed Packages
acl.x86_64                                                                                        2.2.51-14.amzn2                                                                             @amzn2-core
amazon-linux-extras.noarch                                                                        1.6.12-1.amzn2                                                                              @amzn2-core
audit-libs.x86_64                                                                                 2.8.1-3.amzn2.1                                                                             @amzn2-core
basesystem.noarch                                                                                 10.0-7.amzn2.0.1                                                                            installed  
bash.x86_64                                                                                       4.2.46-34.amzn2                                                                             @amzn2-core
bzip2-libs.x86_64                                                                                 1.0.6-13.amzn2.0.2                                                                          installed  
ca-certificates.noarch                                                                            2019.2.32-76.amzn2.0.3                                                                      @amzn2-core
chkconfig.x86_64                                                                                  1.7.4-1.amzn2.0.2                                                                           installed  
coreutils.x86_64                                                                                  8.22-24.amzn2                                                                               installed  
cpio.x86_64                                                                                       2.11-28.amzn2                                                                               @amzn2-core
cracklib.x86_64                                                                                   2.9.0-11.amzn2.0.2                                                                          @amzn2-core
cracklib-dicts.x86_64                                                                             2.9.0-11.amzn2.0.2                                                                          @amzn2-core
cryptsetup-libs.x86_64                                                                            1.7.4-4.amzn2                                                                               @amzn2-core
curl.x86_64                                                                                       7.61.1-12.amzn2.0.2                                                                         @amzn2-core
cyrus-sasl-lib.x86_64                                                                             2.1.26-23.amzn2                                                                             installed  
dbus.x86_64                                                                                       1:1.10.24-7.amzn2                                                                           @amzn2-core
dbus-libs.x86_64                                                                                  1:1.10.24-7.amzn2                                                                           @amzn2-core
device-mapper.x86_64                                                                              7:1.02.146-4.amzn2.0.2                                                                      @amzn2-core
device-mapper-libs.x86_64                                                                         7:1.02.146-4.amzn2.0.2                                                                      @amzn2-core
diffutils.x86_64                                                                                  3.3-5.amzn2                                                                                 installed  
elfutils-default-yama-scope.noarch                                                                0.176-2.amzn2                                                                               @amzn2-core
elfutils-libelf.x86_64                                                                            0.176-2.amzn2                                                                               installed  
elfutils-libs.x86_64                                                                              0.176-2.amzn2                                                                               @amzn2-core
emacs-filesystem.noarch                                                                           1:25.3-3.amzn2.0.2                                                                          @amzn2-core
expat.x86_64                                                                                      2.1.0-12.amzn2                                                                              @amzn2-core
file-libs.x86_64                                                                                  5.11-36.amzn2.0.1                                                                           @amzn2-core
filesystem.x86_64                                                                                 3.2-25.amzn2.0.4                                                                            installed  
findutils.x86_64                                                                                  1:4.5.11-6.amzn2                                                                            installed  
fipscheck.x86_64                                                                                  1.4.1-6.amzn2.0.2                                                                           @amzn2-core
fipscheck-lib.x86_64                                                                              1.4.1-6.amzn2.0.2                                                                           @amzn2-core
gawk.x86_64                                                                                       4.0.2-4.amzn2.1.2                                                                           installed  
gdbm.x86_64                                                                                       1:1.13-6.amzn2.0.2                                                                          installed  
git.x86_64                                                                                        2.23.3-1.amzn2.0.1                                                                          @amzn2-core
git-core.x86_64                                                                                   2.23.3-1.amzn2.0.1                                                                          @amzn2-core
git-core-doc.noarch                                                                               2.23.3-1.amzn2.0.1                                                                          @amzn2-core
glib2.x86_64                                                                                      2.56.1-7.amzn2.0.1                                                                          @amzn2-core
glibc.x86_64                                                                                      2.26-37.amzn2                                                                               @amzn2-core
glibc-common.x86_64                                                                               2.26-37.amzn2                                                                               @amzn2-core
glibc-langpack-en.x86_64                                                                          2.26-37.amzn2                                                                               @amzn2-core
glibc-minimal-langpack.x86_64                                                                     2.26-37.amzn2                                                                               @amzn2-core
gmp.x86_64                                                                                        1:6.0.0-15.amzn2.0.2                                                                        installed  
gnupg2.x86_64                                                                                     2.0.22-5.amzn2.0.4                                                                          installed  
gpgme.x86_64                                                                                      1.3.2-5.amzn2.0.2                                                                           installed  
gpm-libs.x86_64                                                                                   1.20.7-15.amzn2.0.2                                                                         @amzn2-core
grep.x86_64                                                                                       2.20-3.amzn2.0.2                                                                            installed  
groff-base.x86_64                                                                                 1.22.2-8.amzn2.0.2                                                                          @amzn2-core
gzip.x86_64                                                                                       1.5-10.amzn2                                                                                @amzn2-core
info.x86_64                                                                                       5.1-5.amzn2                                                                                 installed  
iputils.x86_64                                                                                    20160308-10.amzn2.0.2                                                                       @amzn2-core
jq.x86_64                                                                                         1.5-1.amzn2.0.2                                                                             @amzn2-core
keyutils-libs.x86_64                                                                              1.5.8-3.amzn2.0.2                                                                           installed  
kmod.x86_64                                                                                       25-3.amzn2.0.2                                                                              @amzn2-core
kmod-libs.x86_64                                                                                  25-3.amzn2.0.2                                                                              @amzn2-core
krb5-libs.x86_64                                                                                  1.15.1-37.amzn2.2.2                                                                         installed  
less.x86_64                                                                                       458-9.amzn2.0.2                                                                             @amzn2-core
libacl.x86_64                                                                                     2.2.51-14.amzn2                                                                             installed  
libassuan.x86_64                                                                                  2.1.0-3.amzn2.0.2                                                                           installed  
libattr.x86_64                                                                                    2.4.46-12.amzn2.0.2                                                                         installed  
libblkid.x86_64                                                                                   2.30.2-2.amzn2.0.4                                                                          installed  
libcap.x86_64                                                                                     2.22-9.amzn2.0.2                                                                            installed  
libcap-ng.x86_64                                                                                  0.7.5-4.amzn2.0.4                                                                           @amzn2-core
libcom_err.x86_64                                                                                 1.42.9-19.amzn2                                                                             @amzn2-core
libcrypt.x86_64                                                                                   2.26-37.amzn2                                                                               @amzn2-core
libcurl.x86_64                                                                                    7.61.1-12.amzn2.0.2                                                                         @amzn2-core
libdb.x86_64                                                                                      5.3.21-24.amzn2.0.3                                                                         installed  
libdb-utils.x86_64                                                                                5.3.21-24.amzn2.0.3                                                                         installed  
libedit.x86_64                                                                                    3.0-12.20121213cvs.amzn2.0.2                                                                @amzn2-core
libevent.x86_64                                                                                   2.0.21-4.amzn2.0.3                                                                          @amzn2-core
libfdisk.x86_64                                                                                   2.30.2-2.amzn2.0.4                                                                          @amzn2-core
libffi.x86_64                                                                                     3.0.13-18.amzn2.0.2                                                                         installed  
libgcc.x86_64                                                                                     7.3.1-9.amzn2                                                                               @amzn2-core
libgcrypt.x86_64                                                                                  1.5.3-14.amzn2.0.2                                                                          installed  
libgpg-error.x86_64                                                                               1.12-3.amzn2.0.3                                                                            installed  
libicu.x86_64                                                                                     50.2-4.amzn2                                                                                @amzn2-core
libidn.x86_64                                                                                     1.28-4.amzn2.0.2                                                                            @amzn2-core
libidn2.x86_64                                                                                    2.3.0-1.amzn2                                                                               installed  
libmetalink.x86_64                                                                                0.1.3-13.amzn2                                                                              @amzn2-core
libmount.x86_64                                                                                   2.30.2-2.amzn2.0.4                                                                          installed  
libnghttp2.x86_64                                                                                 1.41.0-1.amzn2                                                                              @amzn2-core
libpipeline.x86_64                                                                                1.2.3-3.amzn2.0.2                                                                           @amzn2-core
libpwquality.x86_64                                                                               1.2.3-5.amzn2                                                                               @amzn2-core
libsecret.x86_64                                                                                  0.18.5-2.amzn2.0.2                                                                          @amzn2-core
libselinux.x86_64                                                                                 2.5-12.amzn2.0.2                                                                            installed  
libsemanage.x86_64                                                                                2.5-11.amzn2                                                                                @amzn2-core
libsepol.x86_64                                                                                   2.5-8.1.amzn2.0.2                                                                           installed  
libsmartcols.x86_64                                                                               2.30.2-2.amzn2.0.4                                                                          @amzn2-core
libssh2.x86_64                                                                                    1.4.3-12.amzn2.2.3                                                                          @amzn2-core
libstdc++.x86_64                                                                                  7.3.1-9.amzn2                                                                               @amzn2-core
libtasn1.x86_64                                                                                   4.10-1.amzn2.0.2                                                                            installed  
libtirpc.x86_64                                                                                   0.2.4-0.16.amzn2                                                                            @amzn2-core
libunistring.x86_64                                                                               0.9.3-9.amzn2.0.2                                                                           installed  
libutempter.x86_64                                                                                1.1.6-4.amzn2.0.2                                                                           @amzn2-core
libuuid.x86_64                                                                                    2.30.2-2.amzn2.0.4                                                                          installed  
libverto.x86_64                                                                                   0.2.5-4.amzn2.0.2                                                                           installed  
libxml2.x86_64                                                                                    2.9.1-6.amzn2.5.1                                                                           @amzn2-core
lua.x86_64                                                                                        5.1.4-15.amzn2.0.2                                                                          installed  
lz4.x86_64                                                                                        1.7.5-2.amzn2.0.1                                                                           @amzn2-core
make.x86_64                                                                                       1:3.82-24.amzn2                                                                             @amzn2-core
man-db.x86_64                                                                                     2.6.3-9.amzn2.0.3                                                                           @amzn2-core
mariadb.x86_64                                                                                    1:5.5.68-1.amzn2                                                                            @amzn2-core
mariadb-libs.x86_64                                                                               1:5.5.68-1.amzn2                                                                            @amzn2-core
ncurses.x86_64                                                                                    6.0-8.20170212.amzn2.1.3                                                                    installed  
ncurses-base.noarch                                                                               6.0-8.20170212.amzn2.1.3                                                                    installed  
ncurses-libs.x86_64                                                                               6.0-8.20170212.amzn2.1.3                                                                    installed  
nodejs.x86_64                                                                                     2:12.18.4-1nodesource                                                                       installed  
nspr.x86_64                                                                                       4.25.0-2.amzn2                                                                              @amzn2-core
nss.x86_64                                                                                        3.53.1-3.amzn2                                                                              @amzn2-core
nss-pem.x86_64                                                                                    1.0.3-5.amzn2                                                                               installed  
nss-softokn.x86_64                                                                                3.53.1-6.amzn2                                                                              @amzn2-core
nss-softokn-freebl.x86_64                                                                         3.53.1-6.amzn2                                                                              @amzn2-core
nss-sysinit.x86_64                                                                                3.53.1-3.amzn2                                                                              @amzn2-core
nss-tools.x86_64                                                                                  3.53.1-3.amzn2                                                                              @amzn2-core
nss-util.x86_64                                                                                   3.53.1-1.amzn2                                                                              @amzn2-core
oniguruma.x86_64                                                                                  5.9.6-1.amzn2.0.4                                                                           @amzn2-core
openldap.x86_64                                                                                   2.4.44-22.amzn2                                                                             @amzn2-core
openssh.x86_64                                                                                    7.4p1-21.amzn2.0.1                                                                          @amzn2-core
openssh-clients.x86_64                                                                            7.4p1-21.amzn2.0.1                                                                          @amzn2-core
openssl-libs.x86_64                                                                               1:1.0.2k-19.amzn2.0.4                                                                       @amzn2-core
p11-kit.x86_64                                                                                    0.23.21-2.amzn2.0.1                                                                         @amzn2-core
p11-kit-trust.x86_64                                                                              0.23.21-2.amzn2.0.1                                                                         @amzn2-core
pam.x86_64                                                                                        1.1.8-23.amzn2.0.1                                                                          @amzn2-core
pcre.x86_64                                                                                       8.32-17.amzn2.0.2                                                                           installed  
pcre2.x86_64                                                                                      10.23-2.amzn2.0.2                                                                           @amzn2-core
perl.x86_64                                                                                       4:5.16.3-294.amzn2                                                                          @amzn2-core
perl-Carp.noarch                                                                                  1.26-244.amzn2                                                                              @amzn2-core
perl-Encode.x86_64                                                                                2.51-7.amzn2.0.2                                                                            @amzn2-core
perl-Error.noarch                                                                                 1:0.17020-2.amzn2                                                                           @amzn2-core
perl-Exporter.noarch                                                                              5.68-3.amzn2                                                                                @amzn2-core
perl-File-Path.noarch                                                                             2.09-2.amzn2                                                                                @amzn2-core
perl-File-Temp.noarch                                                                             0.23.01-3.amzn2                                                                             @amzn2-core
perl-Filter.x86_64                                                                                1.49-3.amzn2.0.2                                                                            @amzn2-core
perl-Getopt-Long.noarch                                                                           2.40-3.amzn2                                                                                @amzn2-core
perl-Git.noarch                                                                                   2.23.3-1.amzn2.0.1                                                                          @amzn2-core
perl-HTTP-Tiny.noarch                                                                             0.033-3.amzn2                                                                               @amzn2-core
perl-PathTools.x86_64                                                                             3.40-5.amzn2.0.2                                                                            @amzn2-core
perl-Pod-Escapes.noarch                                                                           1:1.04-294.amzn2                                                                            @amzn2-core
perl-Pod-Perldoc.noarch                                                                           3.20-4.amzn2                                                                                @amzn2-core
perl-Pod-Simple.noarch                                                                            1:3.28-4.amzn2                                                                              @amzn2-core
perl-Pod-Usage.noarch                                                                             1.63-3.amzn2                                                                                @amzn2-core
perl-Scalar-List-Utils.x86_64                                                                     1.27-248.amzn2.0.2                                                                          @amzn2-core
perl-Socket.x86_64                                                                                2.010-4.amzn2.0.2                                                                           @amzn2-core
perl-Storable.x86_64                                                                              2.45-3.amzn2.0.2                                                                            @amzn2-core
perl-TermReadKey.x86_64                                                                           2.30-20.amzn2.0.2                                                                           @amzn2-core
perl-Text-ParseWords.noarch                                                                       3.29-4.amzn2                                                                                @amzn2-core
perl-Time-HiRes.x86_64                                                                            4:1.9725-3.amzn2.0.2                                                                        @amzn2-core
perl-Time-Local.noarch                                                                            1.2300-2.amzn2                                                                              @amzn2-core
perl-constant.noarch                                                                              1.27-2.amzn2.0.1                                                                            @amzn2-core
perl-libs.x86_64                                                                                  4:5.16.3-294.amzn2                                                                          @amzn2-core
perl-macros.x86_64                                                                                4:5.16.3-294.amzn2                                                                          @amzn2-core
perl-parent.noarch                                                                                1:0.225-244.amzn2.0.1                                                                       @amzn2-core
perl-podlators.noarch                                                                             2.5.1-3.amzn2.0.1                                                                           @amzn2-core
perl-threads.x86_64                                                                               1.87-4.amzn2.0.2                                                                            @amzn2-core
perl-threads-shared.x86_64                                                                        1.43-6.amzn2.0.2                                                                            @amzn2-core
pinentry.x86_64                                                                                   0.8.1-17.amzn2.0.2                                                                          installed  
popt.x86_64                                                                                       1.13-16.amzn2.0.2                                                                           installed  
powershell.x86_64                                                                                 7.0.3-1.rhel.7                                                                              installed  
procps-ng.x86_64                                                                                  3.3.10-26.amzn2                                                                             @amzn2-core
pth.x86_64                                                                                        2.0.7-23.amzn2.0.2                                                                          installed  
pygpgme.x86_64                                                                                    0.3-9.amzn2.0.2                                                                             installed  
pyliblzma.x86_64                                                                                  0.5.3-11.amzn2.0.2                                                                          installed  
python.x86_64                                                                                     2.7.18-1.amzn2.0.2                                                                          @amzn2-core
python-iniparse.noarch                                                                            0.4-9.amzn2                                                                                 installed  
python-libs.x86_64                                                                                2.7.18-1.amzn2.0.2                                                                          @amzn2-core
python-pycurl.x86_64                                                                              7.19.0-19.amzn2.0.2                                                                         installed  
python-urlgrabber.noarch                                                                          3.10-9.amzn2.0.1                                                                            installed  
python2-rpm.x86_64                                                                                4.11.3-40.amzn2.0.5                                                                         @amzn2-core
python3.x86_64                                                                                    3.7.9-1.amzn2.0.1                                                                           @amzn2-core
python3-libs.x86_64                                                                               3.7.9-1.amzn2.0.1                                                                           @amzn2-core
python3-pip.noarch                                                                                9.0.3-1.amzn2.0.2                                                                           @amzn2-core
python3-setuptools.noarch                                                                         38.4.0-3.amzn2.0.6                                                                          @amzn2-core
pyxattr.x86_64                                                                                    0.5.1-5.amzn2.0.2                                                                           installed  
qrencode-libs.x86_64                                                                              3.4.1-3.amzn2.0.2                                                                           @amzn2-core
readline.x86_64                                                                                   6.2-10.amzn2.0.2                                                                            installed  
rpm.x86_64                                                                                        4.11.3-40.amzn2.0.5                                                                         @amzn2-core
rpm-build-libs.x86_64                                                                             4.11.3-40.amzn2.0.5                                                                         @amzn2-core
rpm-libs.x86_64                                                                                   4.11.3-40.amzn2.0.5                                                                         @amzn2-core
sed.x86_64                                                                                        4.2.2-5.amzn2.0.2                                                                           installed  
setup.noarch                                                                                      2.8.71-10.amzn2.0.1                                                                         installed  
shadow-utils.x86_64                                                                               2:4.1.5.1-24.amzn2.0.2                                                                      @amzn2-core
shared-mime-info.x86_64                                                                           1.8-4.amzn2                                                                                 installed  
sqlite.x86_64                                                                                     3.7.17-8.amzn2.1.1                                                                          installed  
sudo.x86_64                                                                                       1.8.23-4.amzn2.2                                                                            @amzn2-core
system-release.x86_64                                                                             1:2-12.amzn2                                                                                @amzn2-core
systemd.x86_64                                                                                    219-57.amzn2.0.12                                                                           @amzn2-core
systemd-libs.x86_64                                                                               219-57.amzn2.0.12                                                                           @amzn2-core
tar.x86_64                                                                                        2:1.26-35.amzn2                                                                             @amzn2-core
tmux.x86_64                                                                                       1.8-4.amzn2.0.1                                                                             @amzn2-core
tzdata.noarch                                                                                     2020a-1.amzn2                                                                               @amzn2-core
unzip.x86_64                                                                                      6.0-21.amzn2                                                                                @amzn2-core
ustr.x86_64                                                                                       1.0.4-16.amzn2.0.3                                                                          @amzn2-core
util-linux.x86_64                                                                                 2.30.2-2.amzn2.0.4                                                                          @amzn2-core
vim-common.x86_64                                                                                 2:8.1.1602-1.amzn2                                                                          @amzn2-core
vim-enhanced.x86_64                                                                               2:8.1.1602-1.amzn2                                                                          @amzn2-core
vim-filesystem.noarch                                                                             2:8.1.1602-1.amzn2                                                                          @amzn2-core
vim-minimal.x86_64                                                                                2:8.1.1602-1.amzn2                                                                          installed  
wget.x86_64                                                                                       1.14-18.amzn2.1                                                                             @amzn2-core
which.x86_64                                                                                      2.20-7.amzn2.0.2                                                                            @amzn2-core
xz-libs.x86_64                                                                                    5.2.2-1.amzn2.0.2                                                                           installed  
yum.noarch                                                                                        3.4.3-158.amzn2.0.4                                                                         @amzn2-core
yum-metadata-parser.x86_64                                                                        1.1.4-10.amzn2.0.2                                                                          installed  
yum-plugin-ovl.noarch                                                                             1.1.31-46.amzn2.0.1                                                                         installed  
yum-plugin-priorities.noarch                                                                      1.1.31-46.amzn2.0.1                                                                         installed  
zip.x86_64                                                                                        3.0-11.amzn2.0.2                                                                            @amzn2-core
zlib.x86_64                                                                                       1.2.7-18.amzn2                                                                              installed  
zsh.x86_64                                                                                        5.7.1-6.amzn2.0.1                                                                           @amzn2-core
[cloudshell-user@ip-XX-XX-XX-XX ~]$ 
```
なるほどなるほど。

## お試しサンプル～Lambda関数「状態」調査～

きっかけは以下の記事

Coming soon: Expansion of AWS Lambda states to all functions
https://aws.amazon.com/jp/blogs/compute/coming-soon-expansion-of-aws-lambda-states-to-all-functions/

なんのこっちゃと思ってやってみました。
まずは試しにAWS CLIで

```sh
[cloudshell-user@ip-XX-XX-XX-XX ~]$ aws lambda list-functions --query "Functions[].[FunctionName,Handler,Runtime,MemorySize,State]" --output table
-------------------------------------------------------------------------------------------------------------------------------
|                                                        ListFunctions                                                        |
+-------------------------------+----------------------------------------------------------------+-------------+------+-------+
|  test                         |  index.handler                                                 |  nodejs14.x |  128 |  None |
+-------------------------------+----------------------------------------------------------------+-------------+------+-------+
[cloudshell-user@ip-XX-XX-XX-XX ~]$
```

なぜか状態の State だけ取得できません。。。
仕方がなく以下のコマンドに変更。（コマンド引数最後のtestはLambda関数名です）

```sh
[cloudshell-user@ip-XX-XX-XX-XX ~]$ aws lambda get-function-configuration --function-name test
{
    "FunctionName": "test",
    ～（省略）～
    "State": "Active",
    "LastUpdateStatus": "Successful",
    "PackageType": "Zip"
}
[cloudshell-user@ip-XX-XX-XX-XX ~]$
```
取得できた！なるほどなるほど。
"State": "Active","LastUpdateStatus": "Successful" ですね。

試しに該当のLambda関数を更新してみる。

```sh
[cloudshell-user@ip-XX-XX-XX-XX ~]$ aws lambda get-function-configuration --function-name test
{
    "FunctionName": "test",
    ～（省略）～
    "State": "Active",
    "LastUpdateStatus": "InProgress",
    "LastUpdateStatusReason": "The function is being created.",
    "LastUpdateStatusReasonCode": "Creating"
}
[cloudshell-user@ip-XX-XX-XX-XX ~]$
```

なるほどなるほど。
"State": "Active"のまま"LastUpdateStatus": "InProgress"となる。

関数を新規作成した場合は

```sh
[cloudshell-user@ip-XX-XX-XX-XX ~]$ aws lambda get-function-configuration --function-name test
{
    "FunctionName": "test",
    ～（省略）～
    "State": "Pending",
    "StateReason": "The function is being created.",
    "StateReasonCode": "Creating",
    "PackageType": "Zip"
}
[cloudshell-user@ip-XX-XX-XX-XX ~]$
```

なるほどなるほど。
この場合、"State": "Pending"になり"StateReason"とかが付く。
記事の通りですね。
今回のこの調査をVPC内にLambda関数を作成・更新する場合でやりましたが、これがLambda関数全てに適用されるということかな。

> Since launch, states have been used in two primary use-cases. First, to move the blocking setup of VPC resources out of the path of function invocation. Second, to allow the Lambda service to optimize new or updated container images for container-image based functions, also before invocation. By moving this additional work out of the path of the invocation, customers see lower latency and better consistency in their function performance. Soon, we will be expanding states to apply to all Lambda functions.

以上、AWS CloudShell のお試しとLambda関数「状態」調査でした。

## 注意事項

* タイムアウトと永続性 – 各 CloudShell セッションは、20 分程度のアイドル時間後にタイムアウトします。ウィンドウを更新すると、再確立できます。
* ネットワークアクセス – セッションはインターネットへのアウトバウンド接続を確率できますが、インバウンド接続はどの種類でも許可しません。現在、セッションはプライベート VPC サブネット内のリソースに接続できませんが、近日中に接続できるようになる予定です

とのこと。

気になった方は無料なので気軽にお試しあれ！
以上。