aws ec2 describe-instances
aws ec2 describe-images --owners amazon --filters "Name=name,Values=amzn-ami-hvm-*" --query 'Images[*].[ImageId,CreationDate]' --output text | sort -k2 | tail -n 1
aws ec2 create-image --instance-id <instance-id> --name "Updated AMI" --description "Updated AMI for security patching"
aws ec2 terminate-instances --instance-ids <instance-id>
aws ec2 create-security-group --group-name "MySecurityGroup" --description "My security group"
aws ec2 authorize-security-group-ingress --group-id <security-group-id> --protocol tcp --port <port-number> --cidr <ip-range>
aws ec2 authorize-security-group-egress --group-id <security-group-id> --protocol tcp --port <port-number> --cidr <ip-range>
aws s3api create-bucket --bucket <bucket-name> --region <region>
aws cloudtrail create-trail --name <trail-name> --s3-bucket-name <bucket-name>
aws cloudtrail start-logging --name <trail-name>
create_snapshot
method to create a snapshot of the volume.copy_snapshot
method to copy the snapshot and enable encryption during the copy process.create_volume
method to create a new encrypted volume.create_flow_logs
method to enable them.put_configuration_recorder
and put_delivery_channel
methods to enable it.