在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第三方库


热门话题
在IE10中重新加载另一个帧时,internet explorer Java小程序失败/消失   ThreadLocal变量的java性能   java系统。出来println不是打印输出   java从JAXB类获取元素属性   java组织。天啊。科尔巴。包裹。InvalidName:IDL:omg。org/CORBA/ORB/InvalidName:1.0   java有没有办法让非事务连接抛出异常?   java是否有任何方法可以使用JdbcTemplate和查询/条件Fluent API   javajpa级联类型。刷新不工作?   未考虑java Maven依赖关系管理   java MySQL MBR包含抛出MySQLExceptionError的语句   java验证整数并将其设为5位数   java发现了循环依赖的问题   java Hibernate left join fetch到使用@ManyToMany关联映射的softdeleted实体生成无效查询?   JavaH:commandButton多个操作:下载文件并呈现ajax表   Google Contacts API在Java、C#、Python或Ruby中是否有一个Hello World示例?