When we created the EC2 instance, key pair and security group gets created. A keypair and security group can be associated with multiple instances. We might have allocated additional storage, snapshots (backups for the instance) and elastic IPs etc for the instance. All these resources associated with the instance should be deleted since some resources will cost us even after terminating the EC2 instance.
Steps to terminate the EC2 instance:
- Go to Instances in the EC2 Dashboard
- Select the Instance to be terminated
- Click on Actions and then Terminate
- Check the dialog box and delete the suggested resources (like elastic IPs) to avoid the unnecessary costs.
- Once the instance status is terminated, then the volume can be deleted.
- You can delete the keypair and security group if they are not associated with any other instance.
- Deleting the keypair
- EC2 Dashboard Menu -> Keypair -> Select the keypair -> Actions > Delete
- Deleting the Security group
- EC2 Dashboard Menu -> Security group -> Select the Security Group -> Actions -> Delete
- Deleting the Volume
- EC2 Dashboard Menu -> Volume -> Select the Volume -> Actions -> Delete
Now EC2 instance is terminated and its resources are deleted.