Skip to main content
  1. Posts/

Cara Melihat Console dan Log System di AWS EC2

·2 mins·
aws aws
Table of Contents

Pengecekan pada Log system terkadang dilakukan untuk melihat apa yang terjadi pada saat server dalam proses boot.

Begitu juga pengecekan pada sisi console apabila server dalam kondisi tidak dapat diakses, console akan menampilkan beberapa informasi log yang dapat membantu melihat apa yang terjadi pada server. Contoh kasus yang sering ditemui adalah Out of Memory (OOM)

Get system log
#

aws ec2 get-console-output --instance-id i-1234567890abcdef --output text

Output

[    2.916403] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[    2.924492] x86/mm: Checking user space page tables
[    2.980712] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[    2.985018] Run /sbin/init as init process
[    3.146424] systemd[1]: Inserted module 'autofs4'
[    3.183157] systemd[1]: systemd 249.11-0ubuntu3.7 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL
+ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -XKBCOMMON +UTMP +SYSVINIT default-hierarch
y=unified)
[    3.206051] systemd[1]: Detected virtualization xen.
[    3.209956] systemd[1]: Detected architecture x86-64.

Welcome to Ubuntu 22.04.2 LTS!

[    3.218510] systemd[1]: Hostname set to <ubuntu>.
[    3.225963] systemd[1]: Initializing machine ID from random generator.
[    3.230721] systemd[1]: Installed transient /etc/machine-id file.
[    3.603202] systemd[1]: Queued start job for default target Graphical Interface.
[    3.764142] systemd[1]: Created slice Slice /system/modprobe.
[  OK  ] Created slice Slice /system/modprobe.
[    3.774220] systemd[1]: Created slice Slice /system/serial-getty.
[  OK  ] Created slice Slice /system/serial-getty.

Get instance screenshot
#

aws ec2 get-console-screenshot --instance-id i-1234567890abcdef --output text

Output akan berupa text base64-encoded sehingga perlu di decode agar dapat menampilkan screenshot dengan format jpg

aws ec2 get-console-screenshot --instance-id i-1234567890abcdef --output text | base64 -d > ec2sc.jpg

Related

Enable Driver ENA pada Instance EC2
·5 mins
aws aws
Import Disk VM sebagai Snapshot
·1 min
aws aws
Ubah Instance Attribute Amazon EC2
·1 min
aws aws
Export AMI ke file VM
·2 mins
aws aws
Export Instance ke Bucket Amazon S3
·1 min
aws aws
Membuat Access Key User IAM
·1 min
aws aws