<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Naween Fonseka</title>
    <description>The latest articles on DEV Community by Naween Fonseka (@cnf271).</description>
    <link>https://dev.to/cnf271</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F519229%2Ffe805896-d09f-4de9-b0f8-1e5d3c3d2abf.jpg</url>
      <title>DEV Community: Naween Fonseka</title>
      <link>https://dev.to/cnf271</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cnf271"/>
    <language>en</language>
    <item>
      <title>AWS PrivateLink for more secure and cost-effective inter-service communication</title>
      <dc:creator>Naween Fonseka</dc:creator>
      <pubDate>Sat, 04 Sep 2021 14:00:01 +0000</pubDate>
      <link>https://dev.to/aws-builders/aws-privatelink-for-more-secure-and-cost-effective-inter-service-communication-38hh</link>
      <guid>https://dev.to/aws-builders/aws-privatelink-for-more-secure-and-cost-effective-inter-service-communication-38hh</guid>
      <description>&lt;p&gt;In this article, I'll be explaining how to use AWS PrivateLink to secure and more cost-effective AWS inter-service communication. AWS PrivateLink is a widely discussed area in AWS cloud and, yet I have decided to write my recent experience with AWS PrivateLink.&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS PrivateLink
&lt;/h2&gt;

&lt;p&gt;AWS PrivateLink was launched in 2019 to allow users to securely access AWS services without exposing their traffic to the public internet.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;AWS PrivateLink&lt;/strong&gt; is a highly available, scalable technology that enables you to privately connect your VPC to supported AWS services, services hosted by other AWS accounts (VPC endpoint services), and supported AWS Marketplace partner services.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Please find the AWS PrivateLink whitepaper from &lt;a href="https://d1.awsstatic.com/whitepapers/aws-privatelink.pdf" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The following figure describes the usage of PrivateLink. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9h69n97vhd2pytmv1yfz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9h69n97vhd2pytmv1yfz.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As per the above figure, the diagram on the left shows ECS is pulling images from ECR using the public internet even though they are in the same AWS account. AWS PrivateLink, on the other hand, keeps communication with ECS and ECR within the AWS network, making it more secure and cost-effective.&lt;/p&gt;

&lt;p&gt;AWS PrivateLink supports both same region and cross-region access. However, For cross-region PrivateLink to work, you may need to use inter-region VPC peering. In this article,  I will only discuss the use of PrivateLink in the same region. More information about cross-region PrivateLink support may be found &lt;a href="https://aws.amazon.com/about-aws/whats-new/2018/10/aws-privatelink-now-supports-access-over-inter-region-vpc-peering/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  VPC Endpoints
&lt;/h2&gt;

&lt;p&gt;VPC endpoint allows AWS users to connect to AWS services and VPC endpoint services in a secure manner (services hosted by AWS customers and partners are known as VPC endpoint services). AWS PrivateLink is used to power VPC endpoints. AWS PrivateLink uses private IP addresses to communicate with internal AWS services. VPC Endpoints are categorized into three categories: (1) &lt;em&gt;Interface Endpoints&lt;/em&gt;,(2) &lt;em&gt;Gateway Load Balancer Endpoints&lt;/em&gt; and (3) &lt;em&gt;Gateway Endpoints&lt;/em&gt;.&lt;/p&gt;

&lt;h5&gt;
  
  
  Interface Endpoints
&lt;/h5&gt;

&lt;p&gt;AWS PrivateLink connects services provided by AWS using Interface Endpoints (Interface VPC Endpoints). AWS uses Network Load Balancers (NLB) to link interface endpoints to AWS services in the background while utilizing AWS PrivateLink.&lt;/p&gt;

&lt;p&gt;Interface endpoints can be used to connect AWS managed services, customer hosted AWS Services and &lt;a href="https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-service.html" rel="noopener noreferrer"&gt;endpoint services&lt;/a&gt;.&lt;/p&gt;

&lt;h5&gt;
  
  
  Gateway Load Balancer Endpoints (GWLB Endpoints)
&lt;/h5&gt;

&lt;p&gt;GWLB Endpoints are primarily used to intercept network traffic for security inspection. Only services that are configured to use Gateway Load Balancers are supported by GWLB Endpoints.&lt;/p&gt;

&lt;h5&gt;
  
  
  Gateway Endpoints
&lt;/h5&gt;

&lt;p&gt;These types of endpoints are used as a route table target for traffic generated into AWS supported services. At the time of writing this article, only Amazon S3 and DynamoDB are supported for use of Gateway Endpoints.&lt;/p&gt;

&lt;p&gt;Differences between GWLB Endpoints and Gateway Endpoints can be found &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/privatelink-interface-endpoints.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Please note that not all AWS services are supported by PrivateLink, and I'll only go through a handful that can utilize PrivateLink to secure and cost-effectively communicate with other services. Please find &lt;a href="https://docs.aws.amazon.com/vpc/latest/privatelink/integrated-services-vpce-list.html" rel="noopener noreferrer"&gt;this&lt;/a&gt; link which will be useful in finding services that are compatible with PrivateLink.&lt;/p&gt;

&lt;h3&gt;
  
  
  Endpoint for ECR
&lt;/h3&gt;

&lt;p&gt;Amazon ECR is a fully managed container registry that works with EKS, ECS, and Lambda. Please find the following steps to create a PrivateLink for ECR service. Without configuring a PrivateLink for ECR, you have been pulling the images from ECR to EKS/ECS or lambda via public internet by leaving the AWS Network. This comes as an added cost if you are using NAT Gateway to communicate with the public internet. &lt;/p&gt;

&lt;p&gt;For said services to pull images in ECR privately, we may need to create two endpoints.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Interface Endpoint for ECR Docker&lt;/li&gt;
&lt;li&gt;Gateway Endpoint for Amazon S3&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's begin!&lt;/p&gt;

&lt;p&gt;Navigate to the VPC service in AWS Console and create an endpoint using the Create Endpoint button.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdnqnztxfa%2Fimage%2Fupload%2Fv1630005082%2F11_khmu7e.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdnqnztxfa%2Fimage%2Fupload%2Fv1630005082%2F11_khmu7e.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Leave the Service category as default 'AWS Services' and search for 'ecr' under service name. Select Interface &lt;code&gt;com.amazonaws.[region].ecr.dkr&lt;/code&gt;. (select the region you are currently working on)&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbli46qjn46auz0a57j1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbli46qjn46auz0a57j1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the desired VPC and subnets where your instances reside. Leave the &lt;em&gt;Enable DNS name&lt;/em&gt; as ticked.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmspx8of8w2tkljiujvr1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmspx8of8w2tkljiujvr1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a new dedicated security group and allow all inbound HTTPS traffic from port 443. This will allow incoming traffic from the subnets of the selected VPC.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frwqq5f32civ0zccqxnj2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frwqq5f32civ0zccqxnj2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Search and select the newly created security group while keeping the default policy as it is. Create a new tag with Key as &lt;em&gt;Name&lt;/em&gt; and Value as &lt;em&gt;ECR_endpoint&lt;/em&gt; or something you prefer and save the endpoint.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fourl3h2oh4sv9bcet6h9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fourl3h2oh4sv9bcet6h9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Initially, the endpoint will be pending.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1egd6y2fxyynciojknm4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1egd6y2fxyynciojknm4.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The status should change to &lt;em&gt;accessible&lt;/em&gt; in a few minutes if everything goes well.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivf8wwwpqsj1hanir1ld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivf8wwwpqsj1hanir1ld.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Endpoint for S3
&lt;/h3&gt;

&lt;p&gt;As mentioned earlier, for ECR to work privately, we may need to create a Gateway Endpoint for Amazon S3 as ECR uses S3 to store docker images as layers under the hood.&lt;/p&gt;

&lt;p&gt;Same as before. create a new endpoint and search for &lt;code&gt;com.amazonaws.[region].s3&lt;/code&gt;. (select the region you are currently working on).&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhr4ct0ns6o9nq1apa4r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhr4ct0ns6o9nq1apa4r.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the VPC where your instances reside and select the appropriate route table attached to the VPC. Leave the rest as default and save the endpoint.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8ep570p01ao2wcjcntj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8ep570p01ao2wcjcntj.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voilà! Both endpoints should be in &lt;em&gt;available&lt;/em&gt; state after a while.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzsc3g0icbc16d74qjppq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzsc3g0icbc16d74qjppq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
That should do it for ECR. If everything went well, you should experience a sudden change in the NAT gateways metrics (in Cloudawatch). Furthermore, in AWS Cost Explorer, do notice the cost change for &lt;em&gt;EC2-Other ($)&lt;/em&gt; (Cost change might take some time, therefore notice the cost change after few days/weeks).&lt;/p&gt;

&lt;p&gt;There are few other services that can help reduce the cost and enhance AWS security.&lt;/p&gt;

&lt;h3&gt;
  
  
  Endpoint for Cloudwatch Logs
&lt;/h3&gt;

&lt;p&gt;When adding logs to the Cloudwatch by services such as ECS/EKS and Lambda, there are sent to the Cloudwatch through the public internet. This increases both the security risk for sensitive data and NAT Gateway cost.&lt;/p&gt;

&lt;p&gt;To avoid the above, let's create an Interface Gateway for Cloudwatch Logs.&lt;/p&gt;

&lt;p&gt;Head over to the &lt;em&gt;Endpoints&lt;/em&gt; and create a new interface endpoint using &lt;code&gt;com.amazonaws.[region].logs&lt;/code&gt; select the region you are currently working on.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp84ww6uatza64zrhzn13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp84ww6uatza64zrhzn13.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the desired VPC and subnets where your instances reside. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpyyv2t5mjwhwvhh5oyqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpyyv2t5mjwhwvhh5oyqp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a security group same as before by allowing HTTPS traffic through port 443 and save the endpoint.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ecslfshbz84klg8xwzt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ecslfshbz84klg8xwzt.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
Now your logs should be added to Cloudwatch using the internal AWS network.&lt;/p&gt;

&lt;h3&gt;
  
  
  Endpoint for SSM
&lt;/h3&gt;

&lt;p&gt;There's one more service I would like to highlight and that is AWS SSM. This can be useful if you are having an EC2 instance without access to the public internet. For example, by creating an &lt;em&gt;Interface Endpoint&lt;/em&gt; for SSM, your instance can securely access parameters in the &lt;em&gt;Parameter Store&lt;/em&gt; without internet access.&lt;/p&gt;

&lt;p&gt;Let's create a new VPC endpoint using the &lt;code&gt;com.amazonaws.[region].ssm&lt;/code&gt; service. Region should be same as your current selected region in the AWS console.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvokuhb5pah6iuwzqb471.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvokuhb5pah6iuwzqb471.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Same as before, create a new security group for SSM Privatelink with allowing HTTPS access through port 443. Keep the rest the same as before and save the endpoint.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flqv96vridorwy41ovkrz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flqv96vridorwy41ovkrz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, you should have four VPC endpoints in &lt;em&gt;available&lt;/em&gt; state contributing secure inter-service communication to your resources.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fapxutknbz07yt7fo2x53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fapxutknbz07yt7fo2x53.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS PrivateLink with Cross Account
&lt;/h2&gt;

&lt;p&gt;You may be wondering how to use AWS PrivateLink when you have multiple AWS accounts for different environments and, there can be resources that are commonly used by other accounts. For example, all your ECR images could be in one account(Let's say master/root account) and, other accounts such as Staging/Production are using the master/account's ECR to store and pull the images.&lt;/p&gt;

&lt;p&gt;In that case, creating a PrivateLink is similar to the same account PrivateLink creation. PrivateLinks needs to be created in each account that is trying to pull the images from. &lt;br&gt;
Please find the diagram I have created which illustrates PrivateLink usage with multi accounts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmk6w0u20d7swi5815dnk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmk6w0u20d7swi5815dnk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As per the above diagram, secure cross account access with PrivateLink can be achieved by creating VPC endpoints in each account(same region) where you are trying to access the resources (Make sure to avoid creating endpoints in the root/master account).&lt;/p&gt;

&lt;h4&gt;
  
  
  References
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;AWS PrivateLink Whitepaper (&lt;a href="https://d1.awsstatic.com/whitepapers/aws-privatelink.pdf" rel="noopener noreferrer"&gt;https://d1.awsstatic.com/whitepapers/aws-privatelink.pdf&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;AWS PrivateLink and VPC endpoints (&lt;a href="https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-services-overview.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/vpc/latest/privatelink/endpoint-services-overview.html&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Cover photo by &lt;a href="https://unsplash.com/@kalvisuals?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;KAL VISUALS&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/jungle-dark?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>privatelink</category>
    </item>
  </channel>
</rss>
