简体   繁体   English

我是否需要 AWS CLI 才能使用 Boto3?

[英]Do I need to have AWS CLI to use Boto3?

I have a Django application that needs to use Boto3 to create and manage EC2 instances.我有一个需要使用 Boto3 来创建和管理 EC2 实例的 Django 应用程序。 When I host the Django application, do I need to install AWS CLI in the server to use Boto3 in the Django application?当我托管 Django 应用程序时,是否需要在服务器中安装 AWS CLI 才能在 Django 应用程序中使用 Boto3?

You don't need to install the CLI.您不需要安装 CLI。 You just need to use the SDK for Python.您只需要使用适用于 Python 的 SDK。 With the SDK, you can use IAM Roles.通过开发工具包,您可以使用 IAM 角色。 If using EC2, then you would create an Instance Profile, which is nothing but an IAM role where the trusted relationship is EC2, allowing EC2 to act on services on your behalf.如果使用 EC2,那么您将创建一个实例配置文件,它只不过是一个 IAM 角色,其中可信关系是 EC2,允许 EC2 代表您对服务进行操作。

If you are using AWS ECS, then you would create a Task Role or Task Definition Role, which allows ECS to act on services on your behalf.如果您使用的是 AWS ECS,那么您将创建一个任务角色或任务定义角色,它允许 ECS 代表您对服务进行操作。 EKS, which works with Worker Nodes, either as a Fargate Profile or Managed Node Group, also uses the same concept of Execution Roles. EKS 与工作节点一起工作,作为 Fargate 配置文件或托管节点组,也使用相同的执行角色概念。 The bottom line is you can use an IAM role, which will allow you to use Boto3.底线是您可以使用 IAM 角色,这将允许您使用 Boto3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM