1 Answer
- Newest
- Most votes
- Most comments
1
-
It's a known issue, there are bunch of questions like yours in Stackoverflow like https://stackoverflow.com/questions/62210071/aws-codedeploy-for-lambda-cant-read-appspec
-
I remember also having issues with it, I decided to use S3 to store appspec.yml because CodeDeploy simply refused to accept appspec as text. Also I ended up starting deployments from CodeBuild, here are the deployment instructions:
- zip -q -x yarn.lock -x *.git* -r artifact.zip .
- aws lambda update-function-code --region=eu-west-1 --function-name test-pipeline --zip-file fileb://artifact.zip
- newVersion=$(aws lambda publish-version --region=eu-west-1 --function-name test-pipeline --query Version --output text)
- currentVersion=$(aws lambda get-alias --region=eu-west-1 --function-name test-pipeline --name production --query FunctionVersion --output text)
- sed -i "s/%currentVersion%/${currentVersion}/g" appspec.yaml
- sed -i "s/%targetVersion%/${newVersion}/g" appspec.yaml
- aws s3 cp appspec.yaml s3://alex-test-bucket/
- aws deploy create-deployment --region=eu-west-1 --application-name test-pipeline --deployment-group-name test-pipeline-group --s3-location bucket=alex-test-bucket,bundleType=yaml,key=appspec.yaml
Here is appspec.yml
version: 0.0
Resources:
- myLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Name: "test-pipeline"
Alias: "production"
CurrentVersion: "%currentVersion%"
TargetVersion: "%targetVersion%"
Hope it helps
answered 2 years ago
Relevant content
- asked 3 days ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
Thank you for your answer. Its a little ridiculous that the integration between CodeDeploy and CodePipeline is so broken. Deploying from codebuild may be what I end up doing. Or maybe i'll try to keep the deployment separate by doing it in a lambda function...