I wanted to create this post as an addition to my previous post, Running R on AWS EC2 and Logging into RStudio from Anywhere, to show how to secure your AWS environment. Hopefully these articles can help others save time and learn to avoid hours spent reading documentation guides. My purpose for learning about the AWS environment is to securely create and ship shiny apps to share my analysis projects in a better fashion. Setting up the security group of your instance is dependent on the use case for your instances. After looking through some of the basic ways hackers can get into your EC2, most of the vulnerabilities came from storing private keys in the wrong places, and port scans.