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

Bitbucket CI/CD pipeline - Deploy to AWS with Elastic Beanstalk

I am trying to deploy web api on aws elastic beanstalk using bitbucker CI/CD pipeline. Below is the configuration for the same.

image: microsoft/dotnet:sdk

pipelines:
  default:
    - step:
        caches:
          - dotnetcore
        deployment: myapi-test1
        script: # Modify the comma`nds below to build your repository.
          - pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.4
            variables:
              AWS_ACCESS_KEY_ID: '<access_key>'
              AWS_SECRET_ACCESS_KEY: '<secret_key>'
              AWS_DEFAULT_REGION: 'us-east-1'
              APPLICATION_NAME: 'myapi'
              ENVIRONMENT_NAME: 'test'
              ZIP_FILE: 'https://applicationxyz.s3.amazonaws.com/applicationxyz.zip'
              S3_BUCKET: 'myapplication' # Optional.
              # VERSION_LABEL: '<string>' # Optional.
              # DESCRIPTION: '<string>' # Optional.
              # WAIT: '<boolean>' # Optional.
              # WAIT_INTERVAL: '<integer>' # Optional.
              # COMMAND: '<string>' # Optional.
              # DEBUG: '<boolean>' # Optional.

 However, I am getting below error for the zip file.

NFO: The application source bundle doesn't have a known file extension (zip, jar or war). This might cause some issues. INFO: Uploading to s3 bucket: myapplication. The user-provided path https://applicationxyz.s3.amazonaws.com/applicationxyz.zip does not exist.

I am not sure why I am getting this error. Prior to this we are already deploying the web api manually on elastic beanstalk, so there are few zip files already available. So, I have even tried to use those, still the issue is not resolved.

Any help on this appreciated !

3 answers

Hi @Rohit_Pundlik, welcome to the Atlassian Community!

If I may ask, how could you resolve (if not please share your progress as you asked for it) Implementing CI/CD pipeline in bitbucket (asked two days ago). That entry still has not an answer so it's not so clear what happened there and it sounds tremendously related to what you ask here, so I think everyone here can't wait for a bit more of differentiation from your side. So please share!

Hi @ktomk Thanks for the reply. Below are the details what I have tried and I am looking for.

The application which is I am trying to integrate with CI/CD is .net core web api application.

Till now we are deploying this manually on aws elastic beanstalk. The reason I asked here as I didn't find any good documentation OR link which will explain exact steps to be followed for .Net core application. 

As of now I have made some progress, which is resulting in beanstalk environment trying to deploy the application but with the errors. 

Below is the modified configuration as of now

image: atlassian/default-image:2

pipelines:
  default:
    - step:
        name: "Build and Test"
        script:
          - echo "Everything is awesome!"
          - apt-get update
          - apt-get install -y zip
          - zip -j application.zip MyApplication.WebAPI/*
          - pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.3
            variables:
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              APPLICATION_NAME: $APPLICATION_NAME
              COMMAND: 'upload-only'
              ZIP_FILE: 'application.zip'
              S3_BUCKET: 'bitbucketcicd'
              VERSION_LABEL: 'deployApi-$BITBUCKET_BUILD_NUMBER-multiple'
    - step:
        name: "Deploy to Test"
        deployment: test
        script:
        - echo "Deployment!"
        - pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.3
          variables:
            AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
            AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
            AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
            APPLICATION_NAME: $APPLICATION_NAME
            COMMAND: 'deploy-only'
            VERSION_LABEL: 'deployApi-$BITBUCKET_BUILD_NUMBER-multiple'
            ENVIRONMENT_NAME: $ENVIRONMENT_NAME
            WAIT: 'true'

 

When any .net application is published to aws elastic beanstalk, publish files will be copied to s3 bucket, which are used by elastic beanstalk environment.

So, right now I am not able to understand how can i get the publish files and zip it into specific folder and upload on the s3.

Any help on this appreciated !

Running the pipe should be independent to the  .Net core application.

So the job is just to create the ZIP and upload it.

Maybe it's a path issue. Please try with prefixing:

ZIP_FILE: '${BITBUCKET_CLONE_DIR}/application.zip'

 or

ZIP_FILE: '$BITBUCKET_CLONE_DIR/application.zip'

 

So, Do I need to set any path to this variable? If yes, then which path I should set

Well that was for what those two suggestions for, have you tried if any of them works? Maybe even both?

Or was the suggestion unclear and you didn't know where to copy the two suggestions in? It was just meant to have two alternatives so that you have something to try and test right away.

Yes, its unclear to me and I dont know how to use the $BITBUCKET_CLONE_DIR.  I have tried to use it but didn't got any success.

I have tried number of times for CI/CD but no matter what its still not getting successfully executed. And, I don't know where I am going wrong.

The zip file doesn't contains the files which will be used to execute the application. Files like dll, .json file, project files etc.

Any help on this appreciated as I am looking for this from long time.

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,218 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