#StackBounty: #amazon-web-services #github #amazon-s3 How can I use automation in AWS to replicate a github repo to an S3 bucket (quick…

Bounty: 50

I’d like to try and automate an S3 bucket replication of a Github repo (for the sole reason that Cloudformation modules must reference templates in S3).

This quickstart I tried to use looked like it could do it, but it doesn’t result in success for me, even though github reports success in pushing via the webhook for my repository.

https://aws-quickstart.github.io/quickstart-git2s3/

I configured these parameters.

I am not sure what to configure for allowed IP’s, so I tested fully open.

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

I tried manually executing the code build as well but got this error:

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

The github webhook page reports this response:

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
{}


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.