我最近使用 FastAPI 框架创建了一个 python API,并使其在我的 AWS ECS 服务中运行良好。我已经设置了 /health 端点以供 ALB 进行运行状况检查。我的 ECS 容器的入口点是这个命令
ENTRYPOINT ["app/start.sh"]
Run Code Online (Sandbox Code Playgroud)
这就是我的 start.sh 中的内容
uvicorn main:app --host 0.0.0.0
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,当 ALB 命中 /health 端点时,我的 ECS 日志中充满了 200 OK。非常令人沮丧的是,我几乎找不到我的 API 日志,而 Cloudwatch 中充满了 /health 端点日志。有没有办法可以避免健康端点日志?
@app.get("/health", response_class=PlainTextResponse)
def healthcheck():
return "200"
Run Code Online (Sandbox Code Playgroud) 有谁知道为什么 ECS Fargate 任务会失败并出现此错误?
Timeout waiting for network interface provisioning to complete。我正在使用步骤函数运行 ECS Fargate 任务。步骤函数的 IAM 角色可以访问任务定义。状态机代码看起来也不错。相同的步骤函数之前工作得很好,但我刚才遇到了这个错误。想知道为什么会发生这种情况吗?是偶尔的吗?
如何在尝试使用write_dynamic_frame_from_options. 当我尝试转换数据并将 csv 文件放入另一个 AWS 帐户 S3 存储桶时,我给出了这行代码
glueContext.write_dynamic_frame.from_options(frame = DATA_temp, connection_type = "s3", connection_options = {"path": "s3://{BUCKETNAME}/{FOLDER1}/#0001"}, format = "csv")
Run Code Online (Sandbox Code Playgroud)
我的过程成功完成,但我无法下载或打开该帐户中的文件??
我试图使用 Dynamodb 流和 ProcessPoolExecutor 同时触发 lambda。这是我收到的错误。
场景是当一堆记录(例如 1000 条记录)落入 dynamodb(批量大小 10)时,流会触发 lambda。我之前使用过 ThreadPoolExecutor,它可以工作,但是在一个批次的 10 个进程中,只有 5-8 条记录被处理,剩下的就剩下了。每条记录大约需要 50 秒才能完成。AWS lambda 的 5 分钟限制是否跳过了 ThreadPoolExecutor 中的其他记录。另外,使用 ProcessPoolExecutor 将帮助我解决 ThreadPoolExecutor 的问题???
[Errno 38] Function not implemented: OSError
Traceback (most recent call last):
File "/var/task/ycf_calculator.py", line 464, in main
with ProcessPoolExecutor(max_workers=25) as executor:
File "/var/lang/lib/python3.6/concurrent/futures/process.py", line 390, in __init__
EXTRA_QUEUED_CALLS)
File "/var/lang/lib/python3.6/multiprocessing/context.py", line 102, in Queue
return Queue(maxsize, ctx=self.get_context())
File "/var/lang/lib/python3.6/multiprocessing/queues.py", line 42,in __init__
self._rlock = ctx.Lock()
File "/var/lang/lib/python3.6/multiprocessing/context.py", line 67, in Lock …Run Code Online (Sandbox Code Playgroud) 我正在尝试将我的域从一个 AWS 账户转移到另一个 AWS 账户。我已经尝试过这里给出的 boto3 SDK Route53domains 客户端:https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53domains.html#Route53Domains.Client.transfer_domain_to_another_aws_account但我的代码返回此错误:
'Route53Domains' object has no attribute 'transfer_domain_to_another_aws_account'。除了联系 AWS Support,我如何尝试转移我的域。
import boto3
client = boto3.client('route53domains')
if __name__ == "__main__":
response = client.transfer_domain_to_another_aws_account(
DomainName='domain.com',
AccountId='MY_ACCOUNT_ID'
)
print(response)
Run Code Online (Sandbox Code Playgroud) python-3.x ×3
amazon-ecs ×2
amazon-s3 ×1
aws-fargate ×1
aws-glue ×1
aws-lambda ×1
boto3 ×1
fastapi ×1
pyspark ×1
python ×1
python-3.7 ×1