Toronto, Canada · Support hours Mon–Fri, 9 AM–5 PM ET
+1-647-578-8440 +1-800-406-7400 (US & Intl)

How upload built file to S3 bucket in Bitbucket pipeline

Rez Moss 1 min read
How upload built file to S3 bucket in Bitbucket pipeline

1- Create a bitbucket-pipelines.yml file in your Bitbucket repo.

2- Add this configuration:

            image: node:16

            pipelines:
            default:
                    - step:
                        name: Build App
                        caches:
                        - node
                        script:
                        - echo "Building App"
                        - yarn 
                        - yarn build
                        artifacts: 
                        - build        #Move build folder to next step
                        - build/**
                    - step:
                        name: Zip build folder
                        image: atlassian/default-image:3
                        caches:
                        - node
                        script:
                        - zip -r pkg.zip ./build
                        artifacts: 
                        - pkg.zip  #Move pkg.zip to next step
                    - step:
                        name: Upload to S3
                        deployment: staging
                        image: atlassian/pipelines-awscli
                        caches:
                        - node
                        script:
                        - aws s3 cp pkg.zip s3://MY-BUCKET/   #Copy pkg.zip to S3 bucket

3- Go to Settings => Deployments => Staging and add your AWS credentials as secured variables:

        AWS_ACCESS_KEY_ID
        AWS_SECRET_ACCESS_KEY
        AWS_DEFAULT_REGION

4- Push a commit to your repo. The pipeline builds the app and uploads pkg.zip to your bucket.

Need expert advice? Schedule your AWS consultation today!

Schedule now

Keep reading

All articles →
migration 4 min read

Migrating from On-Premises Servers to AWS EC2 Benefits and Step-by-Step Guide

Why moving on-premises servers to AWS EC2 pays off in cost, scale, and uptime, plus a four-step plan: assess, plan, migrate, optimize.

Read article →
aws 5 min read

Understanding AWS Lambda Pricing - A Comprehensive Breakdown

How AWS Lambda pricing works, how it compares with EC2, and practical ways to cut your Lambda bill.

Read article →
aws 5 min read

Top 5 Innovative Uses of AWS Lambda in Modern Web Applications

Five practical uses of AWS Lambda in web applications: real-time data processing, scheduled tasks, serverless APIs, IoT backends, and security …

Read article →

Need expert help with AWS?

Book a consultation or pick a support plan. Certified engineers answer during business hours, and you can cancel anytime.

See pricingContact us