how to create AWS CodePipeline and codedeploy using AWS lambda? - devops

how to create AWS CodePipeline using AWS lambda ?
lambda function code required to create AWS code pipeline and code deployment ?

Related

How can I deploy aws resources using external Jenkins and terraform. (I don`t like my Jenkins running in ec2 or in aws)

How can I deploy aws resources using external jenkins and terraform. (I don`t like my jenkins running in ec2 or in aws) because it may terminate at any time and every time I have to build from ami or all steps that I do on first time. I mean to say save all settings and credentials etc. So, I looking for some solution to install it on my VM/virtual box and then run pipeline job there and build aws resources/ services using terraform.
You can run terraform or jenkins from anywhere to create resources in AWS.
Jenkins is just an orchestrator tool which will use terraform to create resources.
We only need to change how terraform interact with your AWS environment.
if you are having terraform on one of the AWS EC2 you can utilize EC2 metadata to interact/authenticate with AWS.
now as you move towards your local system or VM you have to change the way how you authenticate with terraform.
you can use below code in terraform to authenticate with AWS
provider "aws" {
region = "us-west-2"
access_key = "my-access-key"
secret_key = "my-secret-key"
}
please refer terraform documentation for more authentication methods
https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration

Migrate Code Repository from Github to AWS CodeCommit using Lambda

I am trying to find a way to migrate Code Repository from Github to AWS CodeCommit programmatically using a Lambda.
I thought about one solution :
Using a lambda docker that runs on ubuntu, cloning the GitHub repository inside the docker and so push the code inside AWS CodeCommit using AWS cli.
Does someone have another idea or solution to achieve this?
Thanks for the help

How to update ECS container/TASK through Jenkins?

Here's a beautiful related Q - "How do I deploy updated Docker images to Amazon ECS tasks?"
But my concern is how to integrate this with CI/CD pipeline when using Jenkins for CI.
Using Jenkins or any Jenkin's plugin is it possible to push the recently build docker image to ECR.
Using Jenkins or any Jenkin's plugin is it possible to update the ECS container/task with the recently built or published (to ECR) image.
you can using aws ecs cli comand to update your services

How to manually schedule job from AWS Lambda?

I want to replace my cron scheduler. Is there a way to schedule an ActiveJob from a Lambda and Cloudwatch? I'm using the Que gem.
You create a schedule for an AWS Lambda to get triggered AWS Cloudwatch Schedule Expressions
AWS Doc -
https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions
To manually trigger your AWS Lambda function you can do it either via the AWS Console, SDK, CLI or use API Gateway, with some security to do so.

jenkins pipeline - Provisioning with CloudFormation

Documentation talks about provisioning Docker containers.
Ansible can be used for environment provisioning with Jenkins.
Using pipeline script , I would like to provision an AWS EC2 instance on AWS cloud using AWS CloudFormation template
Can Jenkins pipeline script reuse CloudFormation templates for provisioning on AWS cloud?
Yes you can use the Jenkins pipeline for provisioning resources on cloud. You can store ur cloudformation code either in SVN or GIT and write a script to pull those resources from SVN and GIT and provision resources using "aws cli" commands in the script you create and use to deploy resources to cloud.
You can create separate jobs for different stages of pipeline and make it work.

Resources