降低VPC端点成本 - 使用CodePipeline部署图像到Amazon ECS

发布于 2025-01-22 18:23:10 字数 756 浏览 0 评论 0原文

我对AWS体系结构有基本的了解,但是我需要一种减少当前成本的方法。我当前的管道如下:

  1. 来自GitHub的源反应应用代码
  2. 使用CodeBuild来构建Docker容器并将其推向ECR。
  3. 出于安全原因,将容器部署到ECS Fargate群集中

,我不希望我的ECS服务自动分配公共IP。取而代之的是,我一直在群集在同一子网中使用的VPC端点,用于以下服务:

  • com.amazonaws.eu-west-west-2.ecr.cr.dkr(interface)
  • com.amazonaws.eam.amazonaws.eu-west-2.ecr。 api(接口)
  • com.amazonaws.eu-west-2.logs(接口)
  • com.amazonaws.eu-west-2.secretsmanager(interface)
  • com.amazonaws.eu-west-west-2.s3(网关

)现在,我的大部分AWS法案都被VPC端点站起来所占据。我想到的两个选项是:

  • 在codepipeline中放置一个云形式步骤,以在ECS部署前站立VPC端点,并在部署后手动删除
  • 在CodePipeline中创建lambda函数步骤,以在部署前站立VPC端点,并在部署前站点,然后再删除。之后删除它们。

是否要么“最佳实践”,还是有其他方法可以在需要时自动创建/删除这些端点? 任何需要的信息都需要让我知道。

I have a basic understanding of AWS architecture, however I need a way to reduce current costs. My current pipeline is as follows:

  1. Source react app code from Github
  2. Use CodeBuild to build a docker container and push it to the ECR.
  3. Deploy the container into ECS Fargate Cluster

For security reasons, I do not want my ECS service to auto-assign a public IP. Instead I have been using VPC endpoints within the same subnets that the cluster operates in, for the following services:

  • com.amazonaws.eu-west-2.ecr.dkr (Interface)
  • com.amazonaws.eu-west-2.ecr.api (Interface)
  • com.amazonaws.eu-west-2.logs (Interface)
  • com.amazonaws.eu-west-2.secretsmanager (Interface)
  • com.amazonaws.eu-west-2.s3 (Gateway)

The downside to this is now the majority of my AWS bill is taken up by having VPC endpoints stood up. The two options I thought of are:

  • Put a CloudFormation step in CodePipeline to stand up the VPC endpoints before ECS deployment, and delete manually after deployment
  • Create a Lambda function step in CodePipeline to stand up the VPC endpoints before deployment, and another Lambda step to delete them afterwards.

Are either of these "best practice" or is there another way I could automatically create/delete these endpoints when required?
Any further info required let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文