Help us understand the problem. What is going on with this article?

bitbucketから、pipeline経由でAWS s3にアップロードする

More than 1 year has passed since last update.

bitbucketで差分管理しているリソースを、AWS s3にpipeline経由でアップロードする。
(静的htmlのみ使用するアクセスが少ないwebサイトをs3のhosting機能で運営することにした。)

リポジトリの設定からEnable Pipelinesをonにして、bitbucket-pipelines.ymlを設置する。

image.png

今回は、masterへのcommitのみ、s3にアップロードする。

qiita.rb
# This is a sample build configuration for Other.
# Check our guides at https://confluence.atlassian.com/x/5Q4SMw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: atlassian/default-image:2

pipelines:
  default:
    - step:
        # set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as environment variables
        name: Deploy to S3
        deployment: test   # set to test, staging or production
        # trigger: manual  # uncomment to have a manual step
        image: atlassian/pipelines-awscli
        script:
          - aws s3 sync --delete . s3://<bucket_name>

AWS側に、s3にアクセスできるユーザを作成する。
今回は、ユーザ、bitbucketを作成して、s3accessにフルでアクセスできるグループに所属させた
image.png

アクセスキーを、リポジトリの設定→Repository variablesに設定する

AWS_ACCESS_KEY_ID アクセスキーID
AWS_DEFAULT_REGION デフォルトリージョン
AWS_SECRET_ACCESS_KEY 対応するキー

image.png

アップロードに成功

image.png

アクセスキーなどを設定しないと、unable to locate credentials

image.png

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした