简体   繁体   English

IIS上的Boto3授权

[英]Boto3 Authorization on IIS

I'm setting up a Django application on IIS with boto3. 我正在使用boto3在IIS上设置Django应用程序。 I got the application running however I'm unable to query any data from AWS due to no profile configuration being detected. 我让应用程序运行但是由于没有检测到配置文件配置,我无法从AWS查询任何数据。

I tried running the application as a service account with AWS permissions. 我尝试将该应用程序作为具有AWS权限的服务帐户运行。 Giving the account R/W permissions to folder. 将帐户R / W权限授予文件夹。 Adding AWSProfileName and AWSProfilesLocation to web.config file I have double checked all common issues regarding this error, however, I think that my configuration might be wrong (perhaps in the web.config file) 将AWSProfileName和AWSProfilesLocation添加到web.config文件我已经仔细检查了有关此错误的所有常见问题,但是,我认为我的配置可能有误(可能在web.config文件中)

Web.Config file: Web.Config文件:

<add key="AWSProfileName" value="Name_of_profile"/>
<add key="AWSProfilesLocation" value="Path_to_credentials_folder"/>

The error I'm getting: The config profile (Profile_Name) could not be found 我得到的错误:无法找到配置文件(Profile_Name)

So I have figured this out. 所以我已经弄明白了。

In my code I was using session to connect to AWS Session(Name_of_role) . 在我的代码中,我使用会话连接到AWS Session(Name_of_role) The parameter should be empty: Session() 参数应为空: Session()

In the web.config file: 在web.config文件中:

<add key="AWSProfileName" value="aws-dev"/>
<add key="AWS_ACCESS_KEY_ID" value=""/>
<add key="aws_secret_access_key" value=""/>
<add key="aws_session_token" value=""/>
<add key="AWS_DEFAULT_REGION" value="us-east-1" />

What happened? 发生了什么?

Python is using environmental variables through wfastcgi which means that it takes environmental variables from the web.config file under <appSettings> tag. Python通过wfastcgi使用环境变量,这意味着它从<appSettings>标记下的web.config文件中获取环境变量。 The necessary configuration that I had to use was under boto3 documentation . 我必须使用的必要配置是在boto3文档下

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

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