Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pipeline Deployment to Lambda

I'm unable to use AWS CodeDeploy for Lambda via Bitbucket Pipelines. It's saying that the bundle needs to be YAML or JSON, but the documentation and examples indicate that I need to create a zip file. Can anyone give me some guidance here? Details follow.

 

Version of pipe: atlassian/aws-code-deploy:0.5.2

Steps to reproduce: Pushing changes to master branch, triggering a pipeline job.

I created my pipeline file using this documentation.

bitbucket-pipelines.yml:

pipelines:
default:
- step:
name: Build and package
script:
- apt-get update && apt-get install -y zip
- zip myapp.zip lambda_function.py appspec.yaml
artifacts:
- myapp.zip
- step:
name: Upload lambda zip
script:
- pipe: atlassian/aws-code-deploy:0.5.2
variables:
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
COMMAND: 'upload'
APPLICATION_NAME: $APPLICATION_NAME
ZIP_FILE: 'myapp.zip'

Relevant Build Log:

aws s3 cp myapp.zip s3://<bucket>/<key>
INFO: Registering a revision for the artifact.aws deploy register-application-revision --application-name <app-name> --revision revisionType=S3,s3Location={bucket=<bucket>,key=<key>,bundleType=zip}
An error occurred (InvalidRevisionException) when calling the RegisterApplicationRevision operation: BundleType must be either YAML or JSON

 

 

1 answer

0 votes

Hi @Jack Brooks ,

Thank you for your question!

We are working on aws-code-deploy pipe adding support AWS ECS and Lambda deploy, not only EC2.

Could you please share more details with us, why did you decide to use aws-code-deploy to deploy lambda instead of aws-lambda-deploy or aws-sam-deploy?

One of the solutions, in your case, might be:

image: atlassian/default-image:2

pipelines:
default:
- step:
name: Build and package
script:
- apt-get update && apt-get install -y zip
- zip myapp.zip lambda_function.py appspec.yaml
artifacts:
- myapp.zip

- step:
name: Deploy lambda
script:
# Update lambda code and publish a new version
- pipe: atlassian/aws-lambda-deploy:0.5.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
FUNCTION_NAME: $FUNCTION_NAME
COMMAND: 'update'
ZIP_FILE: 'myapp.zip'

# Read results from the update pipe into environment variables
-BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes"
- VERSION=$(jq --raw-output '.Version' $BITBUCKET_PIPE_SHARED_STORAGE_DIR/aws-lambda-deploy-env)

# Point an alias to the new lambda version
- pipe: atlassian/aws-lambda-deploy:0.5.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
FUNCTION_NAME: $FUNCTION_NAME
COMMAND: 'alias'
ALIAS: 'production'
VERSION: '${VERSION}'

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,326 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you