Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
The following guide shows how to deploy your files to an AWS S3 bucket using the aws-s3-deploy pipe in Bitbucket Pipelines.
Set up an AWS S3 bucket where deployment artifacts will be copied.
An IAM configured with sufficient permissions to upload artifacts to the AWS S3 bucket.
Clone the AWS S3 pipe example repository.
Add your AWS credentials to Bitbucket Pipelines. In your repo go to Settings, under Pipelines, select Repository variables and add the following variables. Learn more on how to configure Pipelines variables.
Basic usage variables
AWS_ACCESS_KEY_ID (*): Your AWS access key.
AWS_SECRET_ACCESS_KEY (*): Your AWS secret access key. Make sure that you save it as a secured variable.
AWS_DEFAULT_REGION (*): The AWS region code (us-east-1, us-west-2, etc.) of the region containing the AWS resource(s). For more information, The AWS region code (us-east-1, us-west-2, etc.) of the region containing the AWS resource(s). For more information, see Regions and Endpoints.
Setup your CI/CD configuration.
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
image: atlassian/default-image:2
pipelines:
default:
- step:
name: Build artifact
script:
- mkdir artifact
- echo "Pipelines is awesome!" > artifact/index.html
artifacts:
- artifact/*
- step:
name: Deploy to S3
deployment: production
script:
- pipe: atlassian/aws-s3-deploy:0.3.8
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: 'us-east-1'
S3_BUCKET: 'bbci-example-s3-deploy'
LOCAL_PATH: 'artifact'
ACL: 'public-read'
Note: aws-s3-deploy pipe can be mixed with other pipes to create your awesome CI/CD.
Deploy the application to production. Push your application’s code to your Bitbucket repository which will trigger the pipeline. You can then select Pipelines to check pipeline progress.
Now you can check your files in the S3 bucket and focus on building your great application, everything else is handled with Bitbucket Pipelines!
A full end-to-end example is available in this example repository. if you prefer more hands-on experimentation with deploying to your AWS S3 bucket using Pipelines and Pipes.
Was this helpful?