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

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
腾讯CDC
T
Threatpost
L
Lohrmann on Cybersecurity
P
Proofpoint News Feed
The Cloudflare Blog
博客园 - 聂微东
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Project Zero
Project Zero
Simon Willison's Weblog
Simon Willison's Weblog
S
Schneier on Security
Spread Privacy
Spread Privacy
The GitHub Blog
The GitHub Blog
D
DataBreaches.Net
S
Securelist
Schneier on Security
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
博客园 - 叶小钗
量子位
I
InfoQ
J
Java Code Geeks
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
博客园_首页
C
CERT Recently Published Vulnerability Notes
I
Intezer
Y
Y Combinator Blog
T
Tailwind CSS Blog
Microsoft Security Blog
Microsoft Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
About on SuperTechFans
A
Arctic Wolf
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Vercel News
Vercel News
PCI Perspectives
PCI Perspectives
The Last Watchdog
The Last Watchdog
月光博客
月光博客

Alliot's blog

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