# Current instance kernel version :
[ec2-user@ etc]$ hostnamectl
Virtualization: xen
Operating System: Amazon Linux 2
CPE OS Name: cpe:2.3:o:amazon:amazon_linux:2
Kernel: Linux 4.14.214-160.339.amzn2.x86_64
Architecture: x86-64
Last login: Sun Jun 2 14:39:24 2024 from 64.xxx.xxx.xxx
, #_
~\_ ####_ Amazon Linux 2
~~ \_#####\
~~ \###| AL2 End of Life is 2025-06-30.
~~ \#/ ___
~~ V~' '->
~~~ / A newer version of Amazon Linux is available!
~~._. _/
_/ _/ Amazon Linux 2023, GA and supported until 2028-03-15.
_/m/' https://aws.amazon.com/linux/amazon-linux-2023/
# Example of filter to get latest ami ID
ami-0d421d84814b7d51c al2023-ami-2023.4.20240416.0-kernel-6.1-x86_64
[ec2-user@ip-172-31-5-148 ~]$ aws ec2 describe-images --filters "Name=name,Values=al2023-ami-2023.4.202405*" --query "Images[*].[ImageId,Name]" --output text
ami-05172b510cbeb4f59 al2023-ami-2023.4.20240528.0-kernel-6.1-arm64
ami-04fe22dfadec6f0b6 al2023-ami-2023.4.20240528.0-kernel-6.1-x86_64
ami-0ac67a26390dc374d al2023-ami-2023.4.20240513.0-kernel-6.1-x86_64
ami-0f31ae1b67a5bf9f6 al2023-ami-2023.4.20240513.0-kernel-6.1-arm64
# Example command how to create EC2 instance from CLI (review is needed)
aws ec2 run-instances --image-id ami-0example1234567890 --instance-type t2.micro --key-name my-key-pair --security-group-ids sg-0example1234567890 --subnet-id subnet-0example1234567890 --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=my-amazon-linux-2023-instance}]'
# Confirm if instance is in running state
❯ ./list_aws_vms.py
1 i-0ca894b31059846ff my-key 2023-07-22T15:57:08+00:00 {'Code': 16, 'Name': 'running'} 54.xxx.xxx.xxx
# Update create_ec2_vm.md