惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
Cyberwarzone
Cyberwarzone
L
LINUX DO - 最新话题
N
News and Events Feed by Topic
T
Troy Hunt's Blog
Help Net Security
Help Net Security
S
Security @ Cisco Blogs
Google DeepMind News
Google DeepMind News
Security Archives - TechRepublic
Security Archives - TechRepublic
M
MIT News - Artificial intelligence
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V2EX - 技术
V2EX - 技术
Y
Y Combinator Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
大猫的无限游戏
大猫的无限游戏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
SegmentFault 最新的问题
I
InfoQ
H
Hacker News: Front Page
D
Docker
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
博客园 - 【当耐特】
T
Tor Project blog
U
Unit 42
H
Heimdal Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Privacy & Cybersecurity Law Blog
PCI Perspectives
PCI Perspectives
美团技术团队
O
OpenAI News
T
Tailwind CSS Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog
GbyAI
GbyAI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MyScale Blog
MyScale Blog

Alliot's blog

Docker 代理配置机制与作用域 2025年底的安卓搞机备忘录 ArgoCD部署应用出现metadata.annotations过大问题 APC UPS更换电池校准容量 M1 Mac安装低版本Node.js Ansible使用Bitwarden存储Vault密码 Cloudflare Tunnel前置代理支持 CDN场景下配置Vaultwarden启用fail2ban 中银香港丝滑开户总结 从指定路径更新雷池WAF证书 浅浅的调教一下国产智障电视 Nginx proxy_pass到AWS ALB的504问题 OpenV**手动指定路由规则 本地模拟CNAME解析 Nginx搭建WebDAV服务 迎来船新版本的Hexo+NexT 优雅的处理Git多帐号与代理问题 验光配镜扫盲 Prometheus relabel实现动态metrics path
AWS ECS使用EBS作为Volume
Alliot · 2024-03-31 · via Alliot's blog

  在 基于Terraform在AWS ECS中构建Jenkins持续集成体系 一文中, Alliot 采用了 EFS 作为 Jenkins 容器的数据卷,直接挂载了 /var/jenkins_home 目录。
正如评论区提到的, 我们在使用 bursting 模式的 EFS 时,遇到了 IO 性能的问题, 虽然 master + slave 架构的 Jenkins 将构建任务分发到了 slave 节点,减少了 master 节点的压力,但是在启动构建任务时, master 节点依然会有大量的 IO 操作, 这个时候会导致 bursting 模式下的 EFS 瞬间打光 Credit 从而导致整个 master 挂掉。当然,我们可以使用 Provisoning 模式缓解性能问题,但其价格又非常贵,性价比不高。
  好在从今年(2024)的一月开始, AWS ECS 的 Fargate 支持使用 EBS 卷作为 Volume 了。 目前官网的文档还比较分散,这里小记一些需要注意的点。

前置条件

IAM role

  想要使用 EBS 作为 ECS 的数据卷,我们需要为 ECS task 提供一个 ECS infrastructure IAM role,这是一个比较新奇的东西,与前面我们用到的 ECS task execution IAM role 和 Task IAM role 都不同,在这里主要是用来允许 ECS 管理 EBS 的。
Console 和 CLI 配置这个 Role 的方法在前面官方文档已经写的很明白了,这里顺手贴一下 Terraform 创建的代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
locals {
infrastructure_role = [
"AmazonECSInfrastructureRolePolicyForServiceConnectTransportLayerSecurity",
"AmazonECSInfrastructureRolePolicyForVolumes"
]
}

resource "aws_iam_role" "jenkins_service_infrastructure_role" {
name = "jenkins-service-infrastructure-role"

assume_role_policy = jsonencode({
"Statement" = [
{
"Action" = "sts:AssumeRole",
"Effect" = "Allow",
"Principal" = {
"Service" = "ecs.amazonaws.com"
},
"Sid" = "AllowAccessToECSForInfrastructureManagement"
}
],
"Version" = "2012-10-17"
})
force_detach_policies = false
path = "/"
tags = merge(
var.tags
)
}

resource "aws_iam_role_policy_attachment" "this" {
for_each = toset(local.infrastructure_role)
role = aws_iam_role.jenkins_service_infrastructure_role.name
policy_arn = format("arn:aws:iam::aws:policy/service-role/%s", each.key)
}

修改 Task-definition

在 Volume 配置中,”Configuration type” 需要修改为 “Configure at deployment”。

更新 ECS services

选择 “Update” services, 在 Volume 选项中我们可以看到 EBS 的配置,包括容量大小、IOPS、File System等,还可以指定从那个 Snapshot 来创建。
值得注意的是 “Infrastructure role” 务必选择前面我们创建的 role, 否则可能会在创建时出现权限问题。

局限

参考文档

Configuring Amazon EBS volumes at deployment - AWS