Securing EC2 Instances for Kinesis Streams in Private Subnets

Configuring Access for Applications in Private Subnets to Utilize Kinesis Streams

Question

Your development team has set an application on an EC2 Instance.

This instance is currently sitting in a private subnet.

The application needs to make use of Kinesis streams.

How would you ensure that the application would be able to make use of the Kinesis streams service?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - D.

The AWS Documentation mentions the following.

You can use an interface VPC endpoint to keep traffic between your Amazon VPC and Kinesis Data Streams from leaving the Amazon network.

Interface VPC endpoints don't require an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection.

Interface VPC endpoints are powered by AWS PrivateLink, an AWS technology that enables private communication between AWS services using an elastic network interface with private IPs in your Amazon VPC.Option A is incorrect since the Instance should not be moved to a public subnet just for this type of access.

Option B is incorrect since this is used for IPv6 traffic specifically.

Option C is incorrect since this is only used with the S3 and DynamoDB service.

For more information on using streams within a VPC, please refer to the below URL-

https://docs.aws.amazon.com/streams/latest/dev/vpc.html

In this scenario, the EC2 instance is located in a private subnet, which means that it does not have direct access to the internet or AWS services outside the VPC. To allow the application running on the EC2 instance to make use of the Kinesis stream service, we need to provide it with access to the service in a secure way.

The correct answer to the question is C. Use a VPC Endpoint gateway.

A VPC endpoint is a service that enables you to connect to AWS services through a private connection rather than going through the internet. A VPC endpoint gateway is a highly available gateway that provides access to services powered by AWS PrivateLink. It provides a secure and reliable connection between instances in a VPC and AWS services without requiring an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection.

To allow the application running on the EC2 instance to make use of Kinesis stream service, we can create a VPC endpoint for Kinesis in the VPC where the instance is located. The endpoint will create a private connection between the VPC and Kinesis streams service. This private connection will allow the application to access the Kinesis service securely without requiring a public IP address or a NAT instance.

Therefore, the correct approach would be to create a VPC endpoint gateway for Kinesis Streams service and associate it with the private subnet where the EC2 instance resides. This will provide secure and private access to the Kinesis stream service without requiring any public IP addresses or internet connectivity.

Option A, ensuring that an internet gateway is attached to the VPC, would not provide a secure connection and could expose the application and VPC to potential security risks.

Option B, using an egress-only internet gateway, would allow the EC2 instance to communicate with the internet but would not allow it to access the Kinesis stream service.

Option D, using an Interface VPC Endpoint, is another option for providing private access to AWS services from an EC2 instance in a VPC. However, Interface endpoints are used for services that are hosted by other AWS accounts, and not supported by AWS PrivateLink. Since Kinesis stream service is an AWS-owned service, a VPC endpoint gateway is the most appropriate option for providing private access to the service.