Differences between Security group and access key - amazon-web-services

Just googling about the differences between security group and access key in aws. But unable to find the profound details. Could anyone explain it.

A security group is a set of rules for inbound and outbound communication. An access key is a credential for authenticating a user, just like a username + password combination is a set of credentials for authenticating a user.

Security groups are rules to allow traffic to instances. This can be considered similar to iptables in linux.
Access keys are credentials that you can use to manage AWS activity from command line or code.

Related

Are IAM Database credentials enough for public RDS

I understand that it is a long upheld tradition to put your database servers in a private subnet and use a bastion host to access them as needed. But thinking specifically about cloud architecture, does that setup really make sense anymore?
What I am struggling to understand is why a publicly-accessible EC2 instance, that connects to my RDS servers, is more secure than a publicly accessible RDS instance that implements IAM Database Authentication? In both cases, I would use Security Groups to limit incoming connections.
I am using PostreSQL, and according to AWS documentation, enabling IAM authentication will enforce IAM credentials ( whereas for MySQL, I think password authentication will still work).
So is a bastion host really more secure than IAM Authentication and why?
The best security has multiple layers of security. For example, if an ex-staff member has credentials to the database, can they access it from outside of your corporate network? Or if somebody gains access to your bastion, can they also obtain access to the database?
So, yes, it could be considered safe enough to use authentication and to limit access to a specific IP address. It all depends upon your Risk Appetite. If the database contains confidential information that would be highly embarrassing for your company if exposed, then the additional layers of security can be worthwhile.

Open port for all VPCs in AWS account

My requirement is :
For a given AWS account,automate to open a port xyz for all the VPCs of that account for a cidr x.x.x.x/x.Later we would like to apply the same for all the other aws accounts from aws organizations.
My approach is using boto3 api....Get the list of all the VPCs of given account,get it's attached SGs and NACLs and attach the required rule.
Or other solution is as per documentation given for aws network firewall.
I am here to know if there are any better ideas of implementing this.
Thankyou!
It is not possible to "open a port for VPCs".
Each resource attached to an Amazon VPC is associated with Security Group(s). You would need to add an Inbound rule to a Security Group to permit access to a resource.
I would highly recommend against blindly opening a particular port for all resources. It is much more secure to only open access to specific resources that require that access.
Echoing #jarmod's advice, in general you should not modify NACL rules unless you have a very specific reason to do so (eg for creating a DMZ). Security Groups provide adequate access control for the majority of situations.

Restrict wideopen security group rule access through IAM Policy

Overview: Users will be logging into windows EC2 instance directly from their source ip and the source ip tends to change often.
Current State: We have provided IAM users access to modify/create/delete security groups.
Need: Users have an option to add wide open security group rules, which expose unnecessary vulnerabilities.
Is there a way to restrict users adding wide open inbound access(0.0.0.0) to security group rules/restrict them to add only their source ip to the inbound access rule of the security group?
My initial Findings: I checked the IAM docs, I didn't find any way to achieve this. Is there any better workaround to achieve this rather than getting alert/notification after they have added a wide open security group rule?
Unfortunately you've combined two separate things: who can configure security groups (which is managed by IAM permissions), and how security groups are configured (which is up to EC2). You can't do what you've asked for in IAM alone.
This example on the AWS blog shows how you can use Systems Manager to remediate security groups automatically. It's possible that AWS Firewall Manager can help too, but I haven't used it myself.

AWS Rds security group settings consideration

We've setup a RDS for MS SQL database. I'd like to limit database connection only from our own applications such as Website, API, others. Normally we setup the security group like:
The problem is it allows anybody to access. I'd like to only allow some IPs to connect. But I can't do that for my API app which it's running through a Load balancer because there is no fixed ip address.
Any suggestions?
Don't use IP restrictions. When configuring Security Group rules, in the Source field you can also enter Security Group ID of the Instance that you want to allow to access your RDS.
Example from Adding Rules to a Security Group:

Connecting to Amazon RDS DB through Sequel Pro

I am trying to connect Sequel Pro to my Amazon RDS Instance, and while it looks like I have set my security groups correctly to allow access to all-traffic, attempting to connect to it still fails.
This is what I did:
In IAM, I created a new user, and added that user to a group that has a policy that allows full access to RDS.
For the security group that is attached to my RDS instance, I added an Inbound rule to allow all traffic of type MYSQL/Aurora
However, when I enter the endpoint displayed in the RDS screen, along with the username and password I created through IAM, I get an access denied message. Any ideas what I may be missing?