At the time of writing, the AWS EC2 t2.micro instance comes with: 1 vCPU; 6 CPU credits / hour; 1 GiB of RAM and some EBS storage. If you’re using a t2.micro, performance probably isn’t your thing. They’re great for testing little applications out however. The only problem is that if you start to run out of memory then Linux will start killing processes (probably yours).
If you’re creating an instance from scratch you should probably attach an extra volume to it. Whilst you’ll have to use EBS storage with the t2.micro you can choose ephemeral instance storage for the bigger, better instances. Assuming, for now, that you’re using EBS storage and the volume is attached at
/dev/sdg then you can do the folowing:
If you’re using instance storage then AWS will probably have already added an entry for it into fstab. You can use sed to find and replace that entry like so:
Finally, if you’ve already created the instance and really don’t want to stop it then you can use a swap file instead: