Implemented a tag-based access-control system in AWS using IAM users, user groups, custom JSON policies, and Amazon EC2 resource tags.
The project separates development and production EC2 resources using the Env tag. An IAM user representing an intern was allowed to manage development resources, while production resources were never granted to that user.
The final permission test confirmed that the intern could stop the development instance but could not stop the production instance.
- Create separate development and production EC2 resources
- Organize AWS resources using tags
- Create a custom IAM policy using JSON
- Apply permissions through an IAM user group
- Create an IAM user with restricted access
- Test access from the IAM user's perspective
- Protect production resources from unauthorized actions
- Introduce least-privilege concepts and identify where permissions can be tightened
AWS Account
│
├── Amazon EC2
│ ├── Development Instance (nextwork-dev-day3)
│ │ └── Tag: Env = development
│ │
│ └── Production Instance (nextwork-prod-day3)
│ └── Tag: Env = production
│
└── AWS IAM
├── Custom IAM Policy: NextWorkDevEnvironmentPolicy
│ ├── Allow EC2 actions on resources tagged Env=development
│ ├── Allow EC2 describe actions
│ └── Deny EC2 tag creation and deletion
│
└── IAM User Group: nextwork-dev-group
├── Policy attached: NextWorkDevEnvironmentPolicy
└── IAM User: nextwork-dev-day3 (intern)
| Service or tool | Purpose |
|---|---|
| AWS Identity and Access Management | Identity, permission, group, and policy management |
| Amazon EC2 | Development and production compute resources |
| AWS Management Console | Resource configuration and permission testing |
- Identity and Access Management
- Least-privilege concepts (and where this implementation can be tightened)
- Tag-based access control
- Environment separation
- Group-based permission management
- Explicit deny statements
- Implicit deny (default deny) behavior
- IAM policy evaluation
- Production-resource protection
- Permission testing
The EC2 instances were separated using the Env resource tag.
| Resource | Tag key | Tag value |
|---|---|---|
| Development EC2 instance | Env |
development |
| Production EC2 instance | Env |
production |
The IAM policy evaluates the Env tag before allowing the IAM user to perform EC2 management actions.
The custom policy was designed to give the intern EC2 access for development work without granting equivalent control over production resources.
- Allow EC2 actions on resources tagged
Env=development - Allow EC2 describe actions so resources can be viewed in the console
- Explicitly deny EC2 tag creation and deletion
- Production resources are not explicitly denied. They are simply never allowed, so AWS denies them by default
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ec2:*",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:ResourceTag/Env": "development"
}
}
},
{
"Effect": "Allow",
"Action": "ec2:Describe*",
"Resource": "*"
},
{
"Effect": "Deny",
"Action": ["ec2:DeleteTags", "ec2:CreateTags"],
"Resource": "*"
}
]
}Preventing tag changes is important because an IAM user should not be able to change a production resource's tag to development and bypass the access-control policy.
Production note: This learning implementation uses
ec2:*for resources taggedEnv=development. In a production environment, replace it with only the required actions, such asec2:StartInstances,ec2:StopInstances, andec2:RebootInstances.
The sanitized policy file is also available here: configurations/development-access-policy.json
Two EC2 instances were assigned different environment tags:
Env=developmentEnv=production
The tags provide the resource context used by the IAM policy.
A multi-statement JSON policy (NextWorkDevEnvironmentPolicy) was created to control EC2 access according to resource tags.
The policy combines:
EffectActionResourceCondition
An AWS account alias was configured to provide a more user-friendly console sign-in address.
Sensitive account and sign-in information has been removed from the public screenshots.
A user group (nextwork-dev-group) was created, and the custom IAM policy was attached to the group.
Users added to this group inherit the group's permissions.
An IAM user representing an intern was created and added to the user group.
Testing was performed while signed in as this restricted IAM user.
The policy was validated by attempting to stop both EC2 instances.
| Test | Expected result | Actual result |
|---|---|---|
| Stop production instance | Denied | Denied |
| Stop development instance | Allowed | Allowed |
The results confirmed that the tag-based access controls behaved as intended.
Security notice: Sensitive details, including AWS account information, sign-in details, instance identifiers, public IP addresses, and DNS names, were removed before publication.
Development and production EC2 resources are separated using the Env tag.
The custom JSON policy controls EC2 actions according to the resource's environment tag.
An AWS account alias provides a more convenient console sign-in address. Sensitive information has been redacted.
The IAM user signed in using restricted credentials. Identifying and credential-related information has been redacted.
The attempt to stop the production instance was denied because the policy does not allow any action on resources outside the intern's permitted environment.
The development instance was stopped successfully, confirming that the policy allowed the required action on development resources.
The IAM user attempted to stop the production EC2 instance.
Result: Access denied.
This confirmed that the user could not manage resources tagged Env=production.
The IAM user attempted to stop the development EC2 instance.
Result: Action successful.
This confirmed that the user could manage resources tagged Env=development.
- Development and production environments separated using tags
- Permissions assigned through an IAM user group
- Tag-based policy conditions applied
- Production management actions not granted (denied by default)
- Tag modification explicitly denied
- Permissions tested using the restricted IAM user
- Sensitive identifiers removed from public screenshots
- No AWS credentials or private keys stored in the repository
The most challenging part was understanding how multiple IAM policy statements work together.
The policy required separate statements for:
- Development-resource access
- Read-only EC2 visibility
- Explicit denial of tag modifications
Testing the policy from the IAM user's account helped demonstrate how AWS evaluates allow and deny statements.
The policy depended on the EC2 resources having the correct Env tag.
Testing both instances confirmed that the condition applied to development resources without granting the same access to production resources.
This project provided practical experience with:
- IAM users and user groups
- Custom JSON policies
- IAM policy statements and conditions
- Tag-based access control
- EC2 resource tagging
- Least-privilege principles and opportunities for permission refinement
- Explicit deny versus implicit deny behavior
- Development and production separation
- Access-control testing
This access-control model enables organizations to give developers and interns access to development resources without exposing production workloads to unnecessary risk.
The approach can help:
- Reduce accidental production changes
- Standardize access through IAM groups
- Improve environment separation
- Apply permissions consistently using resource tags
- Support scalable identity and permission management
- Replace long-term IAM users with IAM Identity Center
- Require multi-factor authentication
- Add CloudTrail logging for IAM and EC2 activity
- Add CloudWatch alerts for denied production actions
- Implement the policy through Terraform
- Use permission boundaries for additional protection
- Add automated IAM policy validation
- Apply more specific EC2 actions instead of broad permissions
aws-cloud-security-iam/
├── README.md
├── LICENSE
├── images/
│ ├── README.md
│ ├── 01-ec2-resource-tags.png
│ ├── 02-iam-json-policy.png
│ ├── 03-aws-account-alias-redacted.png
│ ├── 04-iam-user-sign-in-redacted.png
│ ├── 05-production-access-denied-redacted.png
│ └── 06-development-instance-stopped-redacted.png
├── configurations/
│ ├── README.md
│ ├── development-access-policy.json
│ └── resource-tagging.md
└── documentation/
├── README.md
├── implementation-notes.md
└── policy-testing.md
This project was originally completed as part of the NextWork Cloud Engineering learning path.
To showcase practical cloud-security skills, the repository was expanded with:
- Professional documentation
- IAM policy explanations
- Security considerations
- Access-control test results
- Sanitized configuration files
- Redacted project screenshots
- Business-value analysis
- Future security improvements
These additions go beyond the original project deliverables and better demonstrate practical AWS IAM skills.
✅ Completed
Aspiring Cloud and DevOps Engineer focused on AWS, Linux, Docker, Git, cloud security, and automation.





