简体   繁体   中英

Is there a simple way to copy a repository fragment from CodeCommit to S3?

I use a combination of a static code generator and webpack to generate a static site, which I then manually copy to S3 (to further expose it though CloudFront) via the AWS cli.

I manage my code with git locally and on a local git server, and was considering a move to CodeCommit to have a complete integration with AWS. The first step would be to synchronize the dest folder of my repo with an S3 bucket.

I was hoping for a simple integration ("copy upon a push event") but did not find any. I saw a few discussions on that subject with a recent blog post being the closest to what I want to achieve.

It is however a complicated process, involving mysterious setups across three services.

Is there something I missed? A more obvious solution that the answer to a previous SO question ?

You can add an additional remote on your local repository, and sync/push changes directly to AWS. When you feel the time is right you can stop using either of them. Once you created the AWS CodeCommit you can add the remote as followed:

git remote add [REMOTE NAME] https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo
# Set a new remote
git remote -v
# Verify new remote

For the second part to upload to S3 your destination folder, what engine are you using for your static website? If its NPM you could you at the following for example; https://www.npmjs.com/package/s3-deploy

Once you have it working locally you can go the Stelligent route and integrate it in a pipeline, where you have AWS Build trigger your local build step and push it automatic to your S3 Folder.

Are you currently a CodePipeline user? The simplest way would probably be to set up a pipeline with CodeCommit as a source action (CodePipeline automatically uploads all artifacts to S3, and you can specify the bucket on pipeline creation); however, I don't know if that's as simple a solution as you're hoping to find, since it involves configuring at least one other service.

-Paige@AWS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM