I have a CI/CD pipeline from GitLab to AWS ECR and I would help/guidance to set up a CodePipeline that will automatically update my running image whenever a new image is pushed to ECR via GitLab CI/CD.
In CodePipeline I added GitLab in the source stage. I skipped build stage (as this done with GitLab CI/CD to ECR), and now I'm stuck at deploy stage. I cannot find AWS Lambda in the dropdown list. I copied a script (from the link below) but I cannot figure out how to add the script to the deploy stage.
The script essentially checks the image in ECR and updates the task when a push request is made to the branch in GitLab.
I used this guide as a reference https://aws.plainenglish.io/automate-application-deployment-using-aws-codepipeline-ecr-to-ecs-122feaafcd93. I understand I don't need a build stage as this is done with GitLab CI/CD but I can't figure this out
So you are trying to run a script to perform some sort of custom automation in your pipeline, and you want to run that as a Lambda function. You can only do that during the build phase, as an AWS CodeBuild step. You note that you are doing the actual build elsewhere, so you skipped the build phase in your CodePipeline.
The thing to understand here is AWS CodeBuild isn't just for doing builds, it is for running any type of script/automation in a CodePipeline. You can do things like run unit tests, database migrations, etc. in CodeBuild. Don't let the name mislead you. Think of CodeBuild more as a generic script runner than an actual build engine.
So you need to add a CodeBuild step in the build phase of your pipeline. When you do that, you can select AWS Lambda as the build execution environment, and you can use your script there.