Interview Prep/DevSecOps/Cloud Security, CIS and Compliance

What are VPC endpoints and endpoint policies used for?

IntermediateConceptCloud Security, CIS and Compliance
Answer

VPC endpoints let resources reach AWS services privately, without an internet or NAT path. Gateway endpoints cover S3 and DynamoDB; interface endpoints (PrivateLink) cover most others.

Endpoint policies restrict what can be done through the endpoint, e.g. only access to buckets owned by our organisation, which blocks data exfiltration to an attacker's bucket:

{ "Effect": "Allow", "Principal": "*", "Action": "s3:*", "Resource": "*",
  "Condition": { "StringEquals": { "aws:ResourceOrgID": "o-abc123" } } }

Combine with bucket policies using aws:SourceVpce to make the bucket reachable only through that endpoint.

All DevSecOps questions Roadmap: Policy as code

More on Cloud Security, CIS and Compliance