![](/img/trans.png)
[英]Restrict Access for FLASK Application deployed to AWS ElasticBeanStalk
[英]How to give ElasticBeanstalk access to AWS CodeCommit
我正在將Flask應用程序部署到ElasticBeanstalk。 此應用程序的依賴項之一是應從CodeCommit git存儲庫安裝的軟件包。
在本地,我已經成功設置了SSH以連接到CodeCommit存儲庫以pip install
和推送代碼。 我已經將軟件包添加到requirements.txt
,並且在本地使用pip
可以很好地安裝。
問題是,我應該如何配置EBS使其具有對此存儲庫的SSH訪問權限?
我看到EBS使用的IAM角色是aws-elasticbeanstalk-ec2-role
。 我將AWSCodeCommitReadOnly
策略附加到了該角色,但無濟於事。
在eb-activity.log
,當嘗試從CodeCommit獲取軟件包時,它給出SSH錯誤:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
如何配置從EBS對AWS CodeCommit的訪問?
我的建議是使用HTTPS而不是SSH來訪問您的AWS CodeCommit存儲庫。 您的實例已經通過您設置的角色和策略以及可用的AWS CLI擁有權限。 您需要做的就是運行配置git-credential幫助程序的命令:
git config --global credential.helper'!aws --profile default codecommit credential-helper $ @'
git config --global憑證.UseHttpPath true
希望有幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.