AWS console to github - amazon-web-services

I'd like to know if I can use my git repository for AWS console ? In fact i made a rails project on AWS console but I did not find as to how to transfer it on to my Github repository

You can use AWS Cloud and Github through
Custom Webhooks: Where you have your code store in github and serve through AWS services like EC2, Lambda, etc.
AWS Code Pipeline with Code Commit: The AWS code commit service can be configure to listen to github webhook requests, from there you can trigger events when the webhook is received e.g. Build, tests, deploy
Reference:

Related

how do i publish a serverless application publicly in aws Serverless Application Repository?

I am deploying a hello-world serverless app in AWS Serverless Application Repository. I want to publish the app publicly in the AWS repository. While I am referring AWS documentation, I am asked to provide LicenseUrl: in the metadata section of packaged yaml.
I am a bit confused about where do I get my LicenseUrl in order to publish the app publicly.
( refer aws doc: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-template-publishing-applications.html

Trigger AWS CodePipeline to rebuild my app via webhook

How would I make a webhook (which I'll be using from my CMS) to invoke my CodePipeline?
I've got a simple CodePipeline setup that looks like this.
Source (Github) -> AWS CodeBuild -> AWS S3
It's a Node app that builds an application based on resources from a CMS.
At the moment only committing to the Github Repository invokes CodePipeline to remake my app.
However, I'm wanting a webhook or URL trigger to invoke the CodePipeline to recreate my app when certain changes in the CMS occur.
How do I create a webhook to invoke CodePipeline?
Not sure if it is the cleanest way. If you created an API Gateway that invokes a Lambda. In the lambda you could use one of the AWS sdks to run a script. For example, If you used Python, it would be the boto3.start_build()
That is just the first though I had.
Outside of a sdk or cli, I think Pipelines only work with ECR, S3, CodeCommit, BitBucket, and Github.

How to get BitBucket Server v5.15.1 (on-premise) webhook to trigger Lambda via API Gateway to get into S3?

I'm working with an on-premise older version of BitBucket Server v5.15.1 that does not have the Bitbucket Pipelines feature and I need how to get the webhooks to notify AWS Lambda via HTTPS POST via AWS API Gateway after a commit is made to master branch...then Lambda downloads a copy of the repo, zips it up and places it into an S3 bucket...and of course this is where CodePipeline can finally be triggered...But I'm having issues getting this on-premise BitBucket Server located within my AWS account to connect its webhook to Lambda.
I tried following this documentation below and launched the CloudFormation template with all the needed resources but I'm assuming it is for BitBucket Cloud not Bitbucket Server OP.
https://aws.amazon.com/blogs/devops/integrating-git-with-aws-codepipeline/
Anyones help with this would be really appreciated.
I suppose you are following this below blog from AWS :
https://aws.amazon.com/blogs/devops/integrating-codepipeline-with-on-premises-bitbucket-server/
We had also implemented it. If the event is coming to Lambda, then make sure your Lambda is within a VPC and it has correct outbound(read as inbound) rules to connect the Bitbucket server over HTTPS. Also the Bitbucket server accepts the VPC IP range.

Bitbucket webhook to AWS codeBuild

Recently AWS codebuild webhook supports PULL_REQUEST_MERGED event,which triggers the build every time a pull request is merged.
However we have to enable the merged event in Bitbucket webhook setting if we create a webhook filter group that uses the PULL_REQUEST_MERGED event type.
I am confused what should be the server URL of the AWS code build.
I read many tutorial but most of them are for integration of bitbucket with jenkins, not sure how to configure with AWS.
Thank you for using AWS CodeBuild. For Bitbucket webhook integration, you can check out this CodeBuild Bitbucket webhook sample in CodeBuild user guide.
Basically when you create a bitbucket webhook through CodeBuild console or calling CodeBuild's CreateWebhook API, CodeBuild will create the webhook and fill in the URL for you. You can also configure filter groups with PULL_REQUEST_MERGED event type on CodeBuild console.
After the webhook is created, you can check its settings on Bitbucket site. And you can edit which events will trigger Bitbucket to deliver a webhook payload.

How can I detect when my github repository is pushed to?

Have a website hosted on Amazon Web Services and I want to run a bash script to automatically build my github project when changes are pushed to the repository. How can my aws linux server detect when my repository is pushed to?
You can use GitHub's Webhooks:
Every GitHub repository has the option to communicate with a web server whenever the repository is pushed to. These “webhooks” can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server.
The github-services project supports a large number of popular services out of the box.
Alternatively, you can use Webhooks yourself to configure an HTTP message to be sent to an arbitrary endpoint when a given event occurs. You would need to configure a service that listens for and responds to GitHub's message on your endpoint.
You can register a webhook on your GitHub repo in order to trigger a message to your aws server.
But, as mentioned in "Sync the local code to Amazon server through GitHub webhook", that means you have a listener on that AWS server which would listen to such a message.