Distinguish between two VPC Endpoints calling my VPC Endpoint Service - amazon-web-services

I have a VPC Endpoint Service exposing a MicroService deployed in a private VPC. There are multiple VPC Endpoints created in other AWS accounts and private VPCs that connect to my VPC Endpoint Service.
Is there a way to tell from with in the MicroSevice which VPC Endpoint called it?

You can use VPC flow log to check traffic flowing through your VPC or subnet level. These VPC flow logs while creating them has to be configured to be send logs to either S3 or CloudWatch logs.

Related

Instance in Private Subnet not able to push CloudWatch metrics via VPC Endpoint

I need to implement CloudWatch Monitoring on Instances On a Private Subnet. I have configured a VPC Monitoring Endpoint with a Full Access policy for testing.
The instance on the Public Subnet is able to push metrics via the VPC Endpoint. But the instances on the private endpoint are not connecting to the VPC Endpoint and are trying to connect to the CloudWatch Metrics Public Service Endpoints and are failing.
Only Difference between the subnets is the Internet Gateway Routing Rule.
Can someone help with why this is failing?

One VPC Endpoint for multiple services in AWS

I have VPC with two private subnets in two different AZ and
I am trying to create a VPC Endpoint for connecting lambda to my database in private one of subnet
But I need SNS also for sending message to users based on my lambda function
Do I need to create another endpoint for SNS in that subnet or I can attach multiple services to the same endpoint
I know NAT gateway is an option but it is costly than endpoints
Please suggest best way to do this
Thanks,
Monika
No. A VPC Endpoint is always for a specific service.
By the way, you do not require a VPC Endpoint for Lambda in your situation. Simply configure the AWS Lambda function to connect to the private subnets in the VPC. This is an in-built capability of Lambda functions and the do not require a VPC Endpoint to access the subnets.

AWS How to associate a VPC interface endpoint to a specific NLB in another VPC

I have an existing VPC interface endpoint for elastic load balancer in a VPC A and a NLB in VPC B with a VPC endpoint service associated.
How I can create the association between the VPC interface endpoint and NLB as in the AWS diagram?
According to I can't connect to an endpoint service from my Amazon Virtual Private Cloud (Amazon VPC) interface endpoint using AWS PrivateLink., it looks a request needs to be created.
.
Request that the endpoint service provider accepts the endpoint connection request to activate the connection.
However, I do not see any option to create a request in the VPC endpoint side.
According to Create A VPC Endpoint Service, the request can be created when creating a VPC interface endpoint, but I have already created one.
Please advise how to, or correct me if I misunderstand something.
Go to your VPC Dashboard > Endpoint Service and check under the Endpoint Connections tab. If your VPC endpoint is in the list and the state is Available, then the association you are looking for is established.
One possible reason why you did not have a Pending acceptance status in your VPC endpoint could be that you did not check the Acceptance required box when creating the VPC endpoint service.
Check out AWS New York Summit 2018 - AWS PrivateLink: Fundamentals (SRV211) at 28:08 and 33:33 for the full demo.

Using Lambda inside VPC with SNS+RDS

I'd like to have a lambda expression that every hour makes a query on RDS database, pull some ARN (device tokens) and then sends these devices a notification via SNS. My desire is to remain inside the VPC and I'd like to avoid using NAT due to its cost. Should i create a VPC endpoint (is this called AWS PrivateLink?) that can reach out SNS+RDS? Is NAT and Endpoint similar in billing? Globally is this the right way to achieve a "cron sending notifications" on AWS?
RDS is reachable inside the VPC without the endpoint isn't it?
This is totally possibly
Your lambda can run in a private subnet in the VPC that communicates with your RDS database over the network on port 3306. Make sure your security group and NACL rules allow this.
You then need to create a VPC endpoint to your SNS service. Be sure your route table includes this route.
The main difference between VPC endpoints and AWS Privatelink is the following:
A VPC endpoint enables you to privately connect your VPC to supported AWS services. SNS, Kinesis, SQS, S3,....
While AWS Privatelink is more about creating your own application in your VPC and configuring it as an AWS PrivateLink-powered service (referred to as an endpoint service). Other AWS principals can create a connection from their VPC to your endpoint service using an interface VPC endpoint.
VPC endpoints are free. Nat Gateways cost per hour per GB.

If private S3 endpoints have a route to the Transit Gateway (TGW), can they communicate with other VPCs?

Interface endpoints stay within their own VPC, and typically gateway endpoints (e.g., S3) would as well. However, we have two accounts connected to the same Transit Gateway (TGW), which essentially serves as a hub. In this case, can an S3 gateway endpoint potentially transfer S3 data outside of its own VPC if there is a route to the TGW in the route table that the endpoint is associated with?
No, a gateway endpoint cannot be used outside of a VPC.
The route tables of a VPC are used only to make routing decisions for packets sourced by instances on the subnets associated with the route table. No other traffic, such as traffic from the gateway endpoint or packets entering the VPC from the transit gateway, uses the VPC route tables. VPC never does edge-to-edge routing.
Endpoint connections cannot be extended out of a VPC. Resources on the other side of a VPN connection, VPC peering connection, AWS Direct Connect connection, or ClassicLink connection in your VPC cannot use the endpoint to communicate with resources in the endpoint service.
https://docs.aws.amazon.com/vpc/latest/userguide/vpce-gateway.html#vpc-endpoints-limitations
Yes. it is possible. But check, if you want to route the traffic to and from other availability zone, you have to enable that availability zone to be used by the transit gateway to route traffic to resources in the VPC subnets after attaching the VPC /VPN/Direct connect GWs