Update:
This is because of out of memory. Virtual machine will kill the most long-running command (see: https://serverfault.com/questions/268288/most-long-running-commands-instantly-killed-on-amazon-ec2-ubuntu-10-04):
Using the dmesg command could track the cause to kill the process:
Out of memory: Kill process 16315 (semanage) score 649 or sacrifice child Killed process 16315, UID 0, (semanage) total-vm:347604kB, anon-rss:165468kB, file-rss:4kB
Update again:
I used the t1.micro as the instance type and it does't have much memory (512M). So the semanage failed. Now I changed to use big memory type and it works now.
Also I think adding more memory from swap should work too.