amazon web services - 借助AWS Code将Node.js应用程序从Bit Bucket存储库部署到AWS EC2实例

发布于 2020-03-27 10:52:13

我有 Angular 的应用程序,后端在node.js上。现在,我想使用位桶管道和AWS Code Deploy将应用程序从位桶存储库部署到AWS EC2实例。

当我尝试在EC2实例中安装AWS Code Deployment Agent时,出现禁止错误。(403错误代码)

这是一个权限问题,我缺少一些与配置相关的权限。

我正在尝试通过遵循以下文章在AWS Code Deploy的帮助下进行部署。

https://levelup.gitconnected.com/set-up-a-continuous-delivery-pipeline-from-bitbucket-to-aws-ec2-using-aws-code-deploy-a9777a3cbcad

尝试在EC2实例中安装AWS Code Deployment Agent时出现错误。

ubuntu@ip-10-245-1-43:~$ wget https://aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com/latest/install
--2019-07-03 13:14:17--  https://aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com/latest/install
Resolving aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com (aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com)... 52.216.130.237
Connecting to aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com (aws-codedeploy-bitbucket-us-east-1.s3.us-east-1.amazonaws.com)|52.216.130.237|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2019-07-03 13:14:17 ERROR 403: Forbidden.

我想运行bitbucket-pipeline.yml文件并得到以下错误:

 --env=COMMAND="upload" \
   --env=S3_BUCKET="$S3_BUCKET" \
   --env=VERSION_LABEL="my-app-1.0.0" \
   --env=ZIP_FILE="application.zip" \
   --add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \
   bitbucketpipelines/aws-code-deploy:0.2.5
Unable to find image 'bitbucketpipelines/aws-code-deploy:0.2.5' locally
0.2.5: Pulling from bitbucketpipelines/aws-code-deploy
c67f3896b22c: Pulling fs layer
410e0473b28d: Pulling fs layer
935eaadc5887: Pulling fs layer
7e21295cc8c2: Pulling fs layer
3073cb4153c5: Pulling fs layer
7e21295cc8c2: Waiting
3073cb4153c5: Waiting
c67f3896b22c: Verifying Checksum
c67f3896b22c: Download complete
935eaadc5887: Download complete
7e21295cc8c2: Verifying Checksum
7e21295cc8c2: Download complete
3073cb4153c5: Verifying Checksum
3073cb4153c5: Download complete
c67f3896b22c: Pull complete
410e0473b28d: Verifying Checksum
410e0473b28d: Download complete
410e0473b28d: Pull complete
935eaadc5887: Pull complete
7e21295cc8c2: Pull complete
3073cb4153c5: Pull complete
Digest: sha256:afc573f273389097401321945c6d2f7c0436a8807917ebcc20b53bdff64be9d0
Status: Downloaded newer image for bitbucketpipelines/aws-code-deploy:0.2.5
INFO: Uploading application.zip to S3.
aws s3 cp application.zip s3://CodeDeployApplication-codedeploy-deployment/my-app-1.0.0
✖ Failed to upload application.zip to S3.

感谢你的帮助。

查看更多

查看更多

提问者
stumbler
被浏览
33
stumbler 2019-07-07 03:07

最终,我找到了解决在位桶管道中出现的错误的解决方案。我在位桶中设置环境变量时犯了一些错误。以前,我保持应用程序名称和s3存储桶名称不同。经过一番发现之后,我为两者都输入了相同的名称,并且应用程序已成功上传到AWS s3存储。

谢谢你们。

发布
问题

分享
好友

手机
浏览

扫码手机浏览