[英]How do I use AWS credentials with Jenkins to deploy to Elastic Beanstalk?
I have entered AWS credentials in Jenkins at /credentials
, however they do not show up in the drop down list for the Post Build steps in the AWS Elastic Beanstalk plugin.我已经在 Jenkins 的/credentials
输入了 AWS 凭证,但是它们没有显示在 AWS Elastic Beanstalk 插件的 Post Build 步骤的下拉列表中。
If I click Validate Credentials, I get this strange error.如果我单击验证凭据,我会收到这个奇怪的错误。
Failure com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), com.amazonaws.auth.profile.ProfileCredentialsProvider@5c932b96: profile file cannot be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@32abba7: The requested metadata is not found at http://169.254.169.254/latest/meta-data/iam/security-credentials/] at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:136) com.amazonaws.SdkClientException 失败:无法从链中的任何提供商加载 AWS 凭证:[EnvironmentVariableCredentialsProvider:无法从环境变量(AWS_ACCESS_KEY_ID(或 AWS_ACCESS_KEY)和 AWS_SECRET_KEY(或 AWS_SECRET_ACCESS_KEY))加载 AWS 凭证,SystemPropertiesProvider Unable to load AWSPropertiesCred来自 Java 系统属性(aws.accessKeyId 和 aws.secretKey)的凭据,com.amazonaws.auth.profile.ProfileCredentialsProvider@5c932b96:配置文件不能为空,com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@32abba7:在以下位置找不到请求的元数据http://169.254.169.254/latest/meta-data/iam/security-credentials/]在 com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:136)
I don't know where it got that IP address.我不知道它从哪里获得该 IP 地址。 When I search for that IP in the Jenkins directory, I turn up with当我在 Jenkins 目录中搜索该 IP 时,我出现了
-bash-4.2$ grep -r 169.254.169.254 *
plugins/ec2/AMI-Scripts/ubuntu-init.py:conn = httplib.HTTPConnection("169.254.169.254")
The contents of that file is here: https://pastebin.com/3ShanSSw该文件的内容在这里: https : //pastebin.com/3ShanSSw
There are actually 2 different Amazon Elastic Beanstalk plugins.实际上有 2 个不同的 Amazon Elastic Beanstalk 插件。
Neither of them work.它们都不起作用。 Neither will display the credentials in the drop down list.两者都不会在下拉列表中显示凭据。 Since updating Jenkins, I am unable to even show "Deploy to Elastic Beanstalk" as a post-build step for the first one (v0.3.19) even though it is the only one installed.自从更新 Jenkins 以来,我什至无法将“部署到 Elastic Beanstalk”作为第一个 (v0.3.19) 的构建后步骤,即使它是唯一安装的。
For the 2nd plugin (v1.7.4), I see this screen shot:对于第二个插件(v1.7.4),我看到了这个屏幕截图:
When I fill in what I can, and run it, it gives the error当我填写我可以填写的内容并运行它时,它给出了错误
No credentials provided for build!!!
Environment found (environment id='e-yfwqnurxh6', name='appenvironment'). Attempting to update environment to version label 'sprint5-13'
'appenvironment': Attempt 0/5
'appenvironment': Problem:
com.amazonaws.services.elasticbeanstalk.model.AWSElasticBeanstalkException: No Application Version named 'sprint5-13' found. (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: InvalidParameterValue; Request ID: af9eae4f-ad56-426e-8fe4-4ae75548f3b1)
I tried to add an S3 sub-task to the Elastic Beanstalk deployment, but it failed with an exception.我尝试将 S3 子任务添加到 Elastic Beanstalk 部署中,但失败并出现异常。
No credentials provided for build!!!没有为构建提供凭据!!!
Root File Object is a file.根文件对象是一个文件。 We assume its a zip file, which is okay.我们假设它是一个 zip 文件,这是可以的。
Uploading file awseb-4831053374102655095.zip as s3://appname-sprint5-15.zip上传文件 awseb-4831053374102655095.zip 为 s3://appname-sprint5-15.zip
ERROR: Build step failed with exception错误:构建步骤因异常而失败
com.amazonaws.services.s3.model.AmazonS3Exception: The XML you provided was not well-formed or did not validate against our published schema (Service: Amazon S3; Status Code: 400; Error Code: MalformedXML; Request ID: 7C4734153DB2BC36; S3 Extended Request ID: x7B5HflSeiIw++NGosos08zO5DxP3WIzrUPkZOjjbBv856os69QRBVgic62nW3GpMtBj1IxW7tc=), S3 Extended Request ID: x7B5HflSeiIw++NGosos08zO5DxP3WIzrUPkZOjjbBv856os69QRBVgic62nW3GpMtBj1IxW7tc= com.amazonaws.services.s3.model.AmazonS3Exception:您提供的 XML 格式不正确或未根据我们发布的架构进行验证(服务:Amazon S3;状态代码:400;错误代码:MalformedXML;请求 ID:7C4734153DB2BC36; S3 扩展请求 ID:x7B5HflSeiIw++NGosos08zO5DxP3WIzrUPkZOjjbBv856os69QRBVgic62nW3GpMtBj1IxW7tc=),S3 扩展请求 ID:x7B5HflSeiIwZ5DxP3WIzrUPkZOjjbBv856os69QRBVgic62nW3GpMtBj1IxW7tc=),S3 扩展请求 ID:x7B5HflSeiIwZ++Ngosbgrx2GQB2G2V2G2QB2G2VcsGrossD2GQB2G2P2GQB2G2P2G
Jenkins is hopelessly out of date and unmaintained. 詹金斯绝望地过时了,无法维持。 I added the Post Build Task plugin, installed eb
tool as jenkins
user, ran eb init
in the job directory, edited .elasticbeanstalk/config.yml
to add the lines 我添加了Post Build Task插件,以jenkins
用户身份安装了eb
工具 ,在job目录中运行eb init
,编辑了.elasticbeanstalk/config.yml
以添加行
deploy:
artifact: target/AppName-Sprint5-SNAPSHOT-bin.zip
Then entered in the shell command to deploy the build. 然后在shell命令中输入以部署构建。
/var/lib/jenkins/.local/bin/eb deploy -l sprint5-${BUILD_NUMBER}
对于 Elastic beanstalk 插件,配置 AWS 密钥的正确位置是 Jenkins Master configure
http://{jenkinsURL}/configure
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.