How to attach instance profile on EC2 with cli

This is a quick note to remind me on how to attach or associate an instance profile (IAM role) to an EC2 instance using AWS CLI. In this example, I already have a running EC2 instance i-0357ecc1111111111 running. I want to attach a new instance profile called SSMInstanceProfile to this instance. But as we all know, only one instance profile can be associated with an EC2 instance at one time. So, let’s check to see if our instance already has one attached:...

March 5, 2024 · 2 min · 391 words · kenno

Upgrading RHEL 8 to RHEL 9 on AWS

So I have an EC2 instance running RHEL 8.9 which was recently upgraded from RHEL 7.9. Now, I want to upgrade it all the way to RHEL 9. Here is the worklog which recording the steps I performed to achieve that goal. Step 0, perform a snapshot of the root volume of the instance, or create an AMI from it. In my case, this is just a test instance, so I skip taking the snapshot....

November 22, 2023 · 9 min · 1876 words · kenno

No support for RHEL with high availability in-place upgrade

Well, if you know you know, otherwise, you could have wasted the whole evening trying to upgrade RHEL 7.9 with High Availability to RHEL 8.x, and failed! If you read this post, head to the link at [1] and you’d see that Red Hat does not support i-place upgrades or rolling-upgrades of cluster nodes from one major release of RHEL to another. Here is an extract from [1]: Red Hat does not support in-place upgrades or rolling-upgrades of cluster nodes from one major release of RHEL to another....

November 15, 2023 · 2 min · 377 words · kenno

How to delete Lightsail resources using AWS CLI

In this post, I’ll document how to use AWS CLI to delete a few Lightsail resources. I have never done this before, so this would be a good exercise for me. To make it less boring, I’m writing this post while I’m deleting these resources. First step, I need to look for the instance name [1]. ❯ aws lightsail get-instances --query 'instances[].name' [ "WordPress-1" ] The above output is the name of the instance I’d like to delete....

October 5, 2023 · 3 min · 464 words · kenno

How to delete Memcached cluster using AWS CLI

If you have an ElastiCache Memcached cluster that you no longer need, it’s better to delete it. Dno’t believe me? Even AWS said so too: It is almost always a good idea to delete clusters that you are not actively using. Until a cluster’s status is deleted, you continue to incur charges for it. [1] Well, I have a Memcached cluster that I don’t need anymore. But instead of deleting this cluster using AWS console [1], I’m going to do this via AWS CLI....

September 29, 2023 · 2 min · 326 words · kenno