简体   繁体   English

如何将 AWS 凭证与 Jenkins 结合使用以部署到 Elastic Beanstalk?

[英]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.我已经在 J​​enkins 的/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.

相关问题 如何在 AWS Elastic Beanstalk 上设置和使用 Laravel 调度? - How do I setup and use Laravel Scheduling on AWS Elastic Beanstalk? 如何让 AWS PHP SDK 找到我存储在 Elastic Beanstalk 环境变量中的凭证? - How do I get the AWS PHP SDK to find the credentials I stored in Elastic Beanstalk environment variables? 如何从Jenkins将Python应用程序部署到Amazon Elastic Beanstalk? - How do I deploy a Python application to Amazon Elastic Beanstalk from Jenkins? 当我部署 Elastic Beanstalk 应用程序时,如何替换不再起作用的这个 AWS CLI 命令 - How do I replace this AWS CLI command that is no longer working when I deploy Elastic Beanstalk application 如何通过Elastic Beanstalk手动将.NET MVC应用程序部署到AWS - How do I manually deploy a .NET MVC app to AWS via Elastic Beanstalk AWS Elastic Beanstalk 错误我无法部署 - AWS Elastic Beanstalk error I cannot deploy 如何使用aws cli在Elastic Beanstalk上上传和部署? - How to upload and deploy on Elastic Beanstalk with the aws cli? 如何解决AWS Elastic Beanstalk部署错误 - How to Resolve AWS Elastic Beanstalk Deploy Error 如何使用 github 操作部署到 aws elastic beanstalk? - How to deploy to aws elastic beanstalk with github actions? 使用 Jenkins 管道将 webapp 部署到 AWS Elastic Beanstalk - Deploy webapp to AWS Elastic Beanstalk using Jenkins Pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM