amazon-web-services - 如何使用 AWS 中的自动化将 github 存储库复制到 S3 存储桶 (quickstart-git2s3)?
问题描述
我想尝试自动化 Github 存储库的 S3 存储桶复制(唯一的原因是 Cloudformation 模块必须引用 S3 中的模板)。
我尝试使用的这个快速入门看起来可以做到,但它并没有为我带来成功,即使 github 报告成功通过 webhook 推送我的存储库。
https://aws-quickstart.github.io/quickstart-git2s3/
我配置了这些参数。
我不确定为允许的 IP 配置什么,所以我测试了完全开放的。
AllowedIps 0.0.0.0/0 -
ApiSecret **** -
CustomDomainName - -
ExcludeGit True -
OutputBucketName - -
QSS3BucketName aws-quickstart -
QSS3BucketRegion us-east-1 -
QSS3KeyPrefix quickstart-git2s3/ -
ScmHostnameOverride - -
SubnetIds subnet-124j124 -
VPCCidrRange 172.31.0.0/16 -
VPCId vpc-l1kj4lk2j1l2k4j
我也尝试手动执行代码构建,但出现此错误:
COMMAND_EXECUTION_ERROR: Error while executing command: python3 - << "EOF" from boto3 import client import os s3 = client('s3') kms = client('kms') enckey = s3.get_object(Bucket=os.getenv('KeyBucket'), Key=os.getenv('KeyObject'))['Body'].read() privkey = kms.decrypt(CiphertextBlob=enckey)['Plaintext'] with open('enc_key.pem', 'w') as f: print(privkey.decode("utf-8"), file=f) EOF . Reason: exit status 1
github webhook 页面报告了这个响应:
Headers
Content-Length: 0
Content-Type: application/json
Date: Thu, 24 Jun 2021 21:33:47 GMT
Via: 1.1 9b097dfab92228268a37145aac5629c1.cloudfront.net (CloudFront)
X-Amz-Apigw-Id: 1l4kkn14l14n=
X-Amz-Cf-Id: 1l43k135ln13lj1n3l1kn414==
X-Amz-Cf-Pop: IAD89-C1
X-Amzn-Requestid: 32kjh235-d470-1l412-bafa-l144l1
X-Amzn-Trace-Id: Root=1-60d4fa3b-73d7403073276ca306853b49;Sampled=0
X-Cache: Miss from cloudfront
Body
{}
解决方案
从以下链接:
https://aws-quickstart.github.io/quickstart-git2s3/
您可以看到我包含的以下摘录:
Allowed IP addresses (AllowedIps)
18.205.93.0/25,18.234.32.128/25,13.52.5.0/25
Comma-separated list of allowed IP CIDR blocks. The default addresses listed are BitBucket Cloud IP ranges.
因此,既然您说您使用的是 GitHub,我相信您应该使用此 URL 来确定 IP 范围:
https://api.github.com/meta
由于该 API 将使用 JSON 响应,因此您应该搜索该属性,hooks
因为我相信它是使用钩子描述的。
推荐阅读
- javascript - 以下java脚本箭头函数如何识别索引?
- unit-testing - 如何在不使用 REPL 的情况下使用 Rascal jar 运行测试?
- nginx - 通过负载均衡器访问服务器时间歇性 403,无法弄清楚原因
- javascript - 使用 Firebase 更新文档字段时使用 Object.assign
- javascript - 如何在 vuex 日志中隐藏下一个状态和上一个状态?
- r - 订购功能无法正确订购
- python - Setting nested enum value as default parameter in class __init__
- mysql - I need some design where I can keep more than one value in one column
- python - The order of tests works perfect on python 2 but not on python 3
- c++ - unresolved external symbol CORBA server