As with most Hello World exercises, once the helloworld message is displayed, the goal is reached. It is now time to think about shutting down our server. Since we only pay for what we consume in AWS, freeing up unnecessary resources such as this server is a good strategy for making AWS very cost effective.
We can do a clean shutdown of the Hello World service using the stop command. We can then exit the virtual server and terminate our instance, as follows:
[ec2-user@ip-172-31-22-52 ~]$ sudo stop helloworld helloworld stop/waiting [ec2-user@ip-172-31-22-52 ~]$ ec2-metadata --instance-id instance-id: i-057e8deb1a4c3f35d [ec2-user@ip-172-31-22-52 ~]$ exit logout $ aws ec2 terminate-instances --instance-ids i-057e8deb1a4c3f35d ...