Just to state the obvious for junior folks who might come across this: sudo shutdown now requires access to the operating system (via SSH keys, inbound security groups, etc), while aws ec2 stop-instances is an AWS CLI command which simply requires API authentication (via IAM credentials or STS tokens).
Aside from the obvious difference in invocation, the shutdown is the same.
When you stop or hibernate an instance, we shut it down. You can restart your instance at any time. Before stopping or hibernating an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM, but hibernating an instance does preserve data stored in RAM. If an instance cannot hibernate successfully, a normal shutdown occurs.
Source: stop-instances documentation
The --hibernate flag defaults to false, so a normal shutdown is triggered immediately by your CLI command.
When --hibernate is true, the suspend-to-disk process differs from a regular shutdown (such as sudo shutdown now), and is further documented here.
sudo shutdown nowis well understood. What does a shutdown look like from the OS's perspective when the instance is stopped via the AWS CLI? If the two are the same, EC2 must then gain a command prompt as root on the instance and execute a "sudo shutdown now"? Is that what happens? – CryptoFool Jan 22 '21 at 07:05