在aws fargate中运行的docker容器中生成jupyterhub单用户服务器

fargatespawner的Python项目详细描述


fargatespawner

在aws fargate中运行的docker容器中生成jupyterhub单用户笔记本服务器

安装

pip install fargatespawner

配置

要将jupyterhub配置为使用fargatespawner,可以将以下内容添加到您的jupyterhub_config.py

fromfargatespawnerimportFargateSpawnerc.JupyterHub.spawner_class=FargateSpawner

还必须在jupyterhub_config.py中对c.FargateSpawner设置以下设置。它们都不是可选的。

SettingDescriptionExample
^{}The AWS region in which the tasks are launched.^{}
^{}The hostname of the AWS ECS API. Typically, this is of the form ^{}.^{}
^{}The role the notebook tasks can assume. For example, in order for them to make requests to AWS, such as to use Jupyter S3 with role-based authentication.^{}
^{}The name of the ECS cluster in which the tasks are launched.^{}
^{}The name of the container in the task definition.^{}
^{}The family and revision (family:revision) or full ARN of the task definition that runs the notebooks. Typically, this task definition would specify a docker image that builds on one of those from https://github.com/jupyter/docker-stacks.^{}
^{}The security group(s) associated with the Fargate tasks. These must allow communication to and from the hub/proxy. More information, such as the ports used, is at https://jupyterhub.readthedocs.io/en/stable/getting-started/networking-basics.html.^{}
^{}The subnets associated with the Fargate tasks.^{} }
^{}The port the notebook servers listen on.^{}
^{}The scheme used by the hub and proxy to connect to the notebook servers. At the time of writing ^{} will not work out of the box. However, users do not connect to the the notebook server directly, and does not, typically, allow incoming connections from the public internet. Instead, users connect to the proxy, which can be configured to listen on HTTPS independently of this setting. There is more information on setting up HTTPS for connections to the proxy at https://jupyterhub.readthedocs.io/en/stable/getting-started/security-basics.html.^{}
^{}Additional arguments to be passed to ^{} that starts each notebook server. This can be the empty list.^{}

您还必须使用密钥进行身份验证,在这种情况下,您必须具有以下配置

fromfargatespawnerimportFargateSpawnerSecretAccessKeyAuthenticationc.FargateSpawner.authentication_class=FargateSpawnerSecretAccessKeyAuthentication

上的以下设置c.FargateSpawnerSecretAccessKeyAuthentication

SettingDescriptionExample
^{}The ID of the AWS access key used to sign the requests to the AWS ECS API.ommitted
^{}The secret part of the AWS access key used to sign the requests to the AWS ECS API .ommitted

使用ecs容器中的角色进行身份验证,在这种情况下,您必须具有以下配置

fromfargatespawnerimportFargateSpawnerECSRoleAuthenticationc.FargateSpawner.authentication_class=FargateSpawnerECSRoleAuthentication

其中fargatespawnerecsroleauthentication没有可配置的选项。

运行时依赖项

生成程序被故意编写为除了jupyterhub所需的依赖项之外没有任何其他依赖项。

近似最小权限

为了让用户能够启动、监视和停止任务,他们应该具有以下权限。

{"Version":"2012-10-17","Statement":[{"Sid":"","Effect":"Allow","Action":"ecs:RunTask","Resource":"arn:aws:ecs:<aws_region>:<aws_account_id>:task-definition/<task_family>:*","Condition":{"ArnEquals":{"ecs:cluster":"arn:aws:ecs:<aws_region>:<aws_account_id>:cluster/<cluster_name>"}}},{"Sid":"","Effect":"Allow","Action":"ecs:StopTask","Resource":"arn:aws:ecs:<aws_region>:<aws_account_id>:task/*","Condition":{"ArnEquals":{"ecs:cluster":"arn:aws:ecs:<aws_region>:<aws_account_id>:cluster/<cluster_name>"}}},{"Sid":"","Effect":"Allow","Action":"ecs:DescribeTasks","Resource":"arn:aws:ecs:<aws_region>:<aws_account_id>:task/*","Condition":{"ArnEquals":{"ecs:cluster":"arn:aws:ecs:<aws_region>:<aws_account_id>:cluster/<cluster_name>"}}},{"Sid":"","Effect":"Allow","Action":"iam:PassRole","Resource":["arn:aws:iam::<aws_account_id>:role/<task-execution-role>","arn:aws:iam::<aws_account_id>:role/<task-role>"]}]}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java爬虫获取外部网站搜索结果   java Bluestack未连接到eclipse   java如何从ConstraintViolationException Hibernamte获取数据库字段名   HttpResponse HttpResponse=httpClient引发java运行时错误。执行(httpPost);   Jama中矩阵的java点积和叉积   java有什么方法可以唯一地识别可扩展设备吗?   java我需要用*来写我的名字,但我不断遇到一个错误,我对编码很陌生   java变量是在内部类中访问的。需要被宣布为最终决定。但我不想宣布最终结果   java如何缩短base64图像字符串,Android?   JavaSpringMVC:计划方法不自动触发   图形学习Java 2D API的好资源是什么?   如何在java中对方法进行排队   java JavaFX多行   java Selenium无法在[链接]上找到基于CSS元素的密码字段元素http://www.cartasi.it/gtwpages/index.jsp   Java中的equals()和hashCode()契约   软删除情况下的java Hibernate二级缓存   java为什么这段代码要两次调用这些方法?