In this part of the vProfile re-architecture project, the main focus was preparing the backend access rules before deploying the application. The application will run on Elastic Beanstalk, while backend services like RDS, Amazon MQ, and ElastiCache should stay private inside AWS.
The goal was simple: let trusted services talk to each other securely without exposing databases, caches, or message brokers to the public internet.
Why Create a Separate Backend Security Group?
Instead of managing separate network rules on every backend service, the instructor created one dedicated backend security group. That group can later be attached to all backend resources, keeping the design cleaner and easier to manage.
At this stage, the backend services included:
- Amazon RDS for the database
- Amazon MQ for messaging
- ElastiCache for caching
These services may need to communicate internally, but they should not be publicly reachable. A dedicated security group makes that possible.
Step 1: Create the Security Group in EC2
The instructor opened the AWS console in the North Virginia region, went to EC2, and created a new security group. Even though the resources are RDS, MQ, and ElastiCache, security groups are managed at the VPC level and are often configured from the EC2 section.
- Open AWS Management Console
- Go to EC2
- Open Security Groups
- Click Create security group
The security group was named something like:
This naming keeps it clear that the group belongs to the re-architected vProfile backend setup.
Why No Rule at First?
The instructor wanted to allow traffic from the security group to itself. AWS needs the actual security group ID for that, and you only get that after the group exists.
So the sequence becomes:
- Create the security group
- Get its security group ID
- Edit inbound rules
- Add a rule that uses the same security group as the source
Step 2: Allow All Traffic Within the Same Group
After creation, the inbound rules were updated with a self-referencing rule like this:
This means any resource using this backend security group can talk to another resource that also uses it.
If these resources all use the same SG:
- RDS
- Amazon MQ
- ElastiCache
then they can communicate privately with each other.
What Does “Allow All Traffic Within Itself” Mean?
If a security group allows all traffic from itself, any AWS resource using that group can send traffic to another resource using the same group.
At this point, only backend-to-backend communication is allowed. The application layer will be trusted later.
Step 3: Save the Rule
Once the rule was added and saved, the backend security group was
ready for this stage. No public inbound rule like
0.0.0.0/0 was added, because backend resources should
stay private.
Step 4: Beanstalk Will Be Added Later
The instructor explained that after Elastic Beanstalk creates the environment, AWS will also create security groups for the Beanstalk EC2 instances and the load balancer.
That usually leads to this relationship:
- Load balancer security group sends traffic to app instances
- Beanstalk EC2 instances receive traffic from the load balancer
But one more backend rule will still be needed later:
That future rule is what allows the application layer to connect to RDS, MQ, and ElastiCache.
Simple Traffic Flow
The full flow is easy to picture like this:
- User sends a request
- Load balancer receives it
- Load balancer forwards it to Beanstalk EC2
- The app needs data, cache, or messaging support
- The app connects to RDS, MQ, or ElastiCache
So Beanstalk must eventually be trusted by the backend security group, but that trust comes only after Beanstalk exists.
Step 5: Create a Key Pair for Troubleshooting
After the security group setup, the instructor created a key pair. This is used for SSH access to the EC2 instances launched by Elastic Beanstalk.
- Go to EC2
- Open Key Pairs
- Click Create key pair
- Name it something like
vprofile-rearch-key - Download the private key and store it safely
The key pair is not required for normal Beanstalk operation, but it becomes very useful when troubleshooting.
Why Is the Key Pair Useful?
SSH access helps when deployment issues happen, for example:
- The app does not start
- Environment variables are wrong
- A required service is unreachable
- Logs contain unexpected errors
- A package or process failed during deployment
After logging in, troubleshooting might include commands like:
Security Thinking Behind This Lesson
This part of the project is really about network isolation and controlled trust.
Good cloud architecture separates resources by role:
- Public layer → load balancer
- Application layer → EC2 / Beanstalk
- Private backend layer → database, cache, broker
Each layer should only talk to the layers it actually needs. That reduces risk and makes the overall design easier to secure.
What I Learned from This Lecture
- Security groups are a major part of AWS architecture design
- Backend services should usually stay in a private backend SG
- Self-referencing SG rules allow controlled internal communication
- Elastic Beanstalk creates security groups for app and load balancer layers
- The backend SG must later trust the app SG
- Key pairs help with SSH-based troubleshooting
My Practical Takeaway
This lesson made security groups feel much more important than just another AWS setting. They are a design tool that controls which part of the application can talk to which other part.
Instead of thinking only in terms of servers and services, I now see the architecture more clearly in terms of who can access what, which services remain private, and how trust is added in stages.
Conclusion
This was a small setup step, but it matters a lot for the full architecture. First the backend security group was created, then a self-referencing inbound rule was added so backend services could communicate internally, and finally a key pair was created for possible troubleshooting of the Beanstalk EC2 instances.
In the next stage of the project, backend services can be launched with this security group and the Beanstalk application layer can later be allowed to connect to them securely.