<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pavan Vora</title>
    <description>The latest articles on DEV Community by Pavan Vora (@pavanvora).</description>
    <link>https://dev.to/pavanvora</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F161579%2Ffc2f4a68-5020-46f6-9eac-ee6109cae78a.png</url>
      <title>DEV Community: Pavan Vora</title>
      <link>https://dev.to/pavanvora</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pavanvora"/>
    <language>en</language>
    <item>
      <title>Continuous deployment of Vue.js app to AWS using Bitbucket Pipelines</title>
      <dc:creator>Pavan Vora</dc:creator>
      <pubDate>Thu, 09 May 2019 14:08:37 +0000</pubDate>
      <link>https://dev.to/pavanvora/continuous-deployment-of-vue-js-app-to-aws-using-bitbucket-pipelines-3ol7</link>
      <guid>https://dev.to/pavanvora/continuous-deployment-of-vue-js-app-to-aws-using-bitbucket-pipelines-3ol7</guid>
      <description>&lt;p&gt;Hello guys, I recently created a Bitbucket Pipelines to deploy my Vue.js app on Amazon S3 and today in this article I would like to share the step-by-step process. Before starting I assume that you already have up and running vuejs app on bitbucket and also AWS account.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the steps?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create and configure &lt;strong&gt;Amazon S3 Bucket&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;IAM user&lt;/strong&gt; in AWS console that can access the S3 bucket from Bitbucket.&lt;/li&gt;
&lt;li&gt;Configure Bitbucket to use &lt;strong&gt;Pipelines&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;bitbucket-pipelines.yml&lt;/strong&gt; file in our project.&lt;/li&gt;
&lt;li&gt;Push code to Bitbucket, and check the live vue app.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Create and configure Amazon S3 Bucket
&lt;/h2&gt;

&lt;p&gt;Click &lt;a href="https://console.aws.amazon.com/console/home" rel="noopener noreferrer"&gt;here&lt;/a&gt; to sign in to your AWS Console. After signing in to your aws console click on &lt;strong&gt;Services&lt;/strong&gt; present in the header, look for &lt;strong&gt;S3&lt;/strong&gt; service in storage section and click on it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FdI6ykRf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FdI6ykRf.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After redirecting to S3 page click on &lt;strong&gt;Create Bucket&lt;/strong&gt; button. In the &lt;strong&gt;Name and region&lt;/strong&gt; page type name for your bucket and choose the region where you want your bucket to reside then click on the next button. On the &lt;strong&gt;Configure options&lt;/strong&gt; page no need to make any changes, keep it as it is and click on next button. Now in the &lt;strong&gt;Set permissions&lt;/strong&gt; page we need to make some changes as in below image to make files available publicly. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FjCHLlMN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FjCHLlMN.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see that amazon recommended to tick the options in &lt;strong&gt;Manage public access control lists (ACLs)&lt;/strong&gt;  section but that is only if you want to store private data on this bucket. So to create publicly accessible bucket we'll ignore that recommendation and deselect the two options as given in above image after that you can click on next button, &lt;strong&gt;Review&lt;/strong&gt; the S3 bucket and click on &lt;strong&gt;Create Bucket&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It will take a few seconds to create a bucket after that you can see the bucket in the list of buckets. Click on your bucket name that you just created and you will see something as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FcVKlV1p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FcVKlV1p.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now as our Bucket is created we need to &lt;strong&gt;enable the static site hosting&lt;/strong&gt; for this Bucket. And to do that you can go to &lt;strong&gt;Properties&lt;/strong&gt; tab. Click on &lt;strong&gt;Static website hosting&lt;/strong&gt;, and then choose &lt;strong&gt;Use this bucket to host a website&lt;/strong&gt;. You will be prompted to give index document ( home or default page for website ) enter &lt;strong&gt;index.html&lt;/strong&gt; and before clicking on save you can note down the &lt;strong&gt;Endpoint&lt;/strong&gt; URL where your website will be live in step 5.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FpbW39x4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FpbW39x4.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we have amazon S3 bucket ready with Static website hosting, So let's move on to the next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Create IAM user in AWS console
&lt;/h2&gt;

&lt;p&gt;In this step we'll create the IAM user which will give us two keys &lt;strong&gt;1. Access key ID&lt;/strong&gt; and &lt;strong&gt;2. Secret access key&lt;/strong&gt;. This keys will be used by our bitbucket account to upload the repository code to amazon S3 bucket. To go on IAM service page navigate to &lt;strong&gt;Services &amp;gt; Security, Identity, &amp;amp; Compliance &amp;gt; IAM&lt;/strong&gt; or you can follow the below image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fht42aUz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fht42aUz.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After moving to the &lt;strong&gt;IAM&lt;/strong&gt; service page in the navigation pane, choose &lt;strong&gt;Users&lt;/strong&gt; and then choose &lt;strong&gt;Add user&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FZc6Ww6o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FZc6Ww6o.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Type the &lt;strong&gt;user name&lt;/strong&gt; for new user and choose &lt;strong&gt;Programmatic access&lt;/strong&gt; in Access type then click on &lt;strong&gt;next: Permissions&lt;/strong&gt; button down below. We are creating this user to access the S3 bucket from Bitbucket so I gave the user name as s3-full-access you can use any name you want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FOCu5BHH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FOCu5BHH.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the &lt;strong&gt;Set permissions&lt;/strong&gt; page there are three options, select &lt;strong&gt;Attach existing policies directly&lt;/strong&gt; and you will see the list of available policies. In the search field type &lt;strong&gt;s3full&lt;/strong&gt; and select the policy with name &lt;strong&gt;AmazonS3FullAccess&lt;/strong&gt; then click on &lt;strong&gt;Next: Tags&lt;/strong&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FNxtLsRh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FNxtLsRh.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;Add tags&lt;/strong&gt;  page you can add tags by entering the key-value pairs that will be added to user as metadata. But it is optional so you can go ahead and click on &lt;strong&gt;Next: Review&lt;/strong&gt; button. Review your user details and click on &lt;strong&gt;Create user&lt;/strong&gt; button. Now as mentioned before you will get two keys &lt;strong&gt;1. Access key ID&lt;/strong&gt; and &lt;strong&gt;2. Secret access key&lt;/strong&gt; for the created user. This keys are very important for our app deployment, Copy/Paste both the keys somewhere safe on your PC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FPoFAEuy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FPoFAEuy.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Don't try copying my secret keys from image, because it won't be valid at the time you will be reading this article 😬&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now as our user is created successfully we'll move to next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Configure Bitbucket to use Pipelines
&lt;/h2&gt;

&lt;p&gt;Log in to your Bitbucket account and move to your project repository then follow the below image to enable the pipelines for the repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FqDOHTbi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FqDOHTbi.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After enabling Pipelines, In the repository &lt;strong&gt;Settings&lt;/strong&gt; choose &lt;strong&gt;Repository variables&lt;/strong&gt; from navigation panel. In the Name field write &lt;strong&gt;AWS_ACCESS_KEY_ID&lt;/strong&gt; and in the value paste the value of Access key ID that you copied in last step and click on &lt;strong&gt;Add&lt;/strong&gt; button, again follow the same for secret access key by giving name as &lt;strong&gt;AWS_SECRET_ACCESS_KEY&lt;/strong&gt;. After that you should see something like below image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FoBXvUuZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FoBXvUuZ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This added Repository variables will be used in &lt;strong&gt;bitbucket-pipelines.yml&lt;/strong&gt; file in the next step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Add bitbucket-pipelines.yml file to project
&lt;/h2&gt;

&lt;p&gt;Go to your projects root directory and create a new file with name &lt;strong&gt;bitbucket-pipelines.yml&lt;/strong&gt;. After that copy paste the below code to the &lt;strong&gt;bitbucket-pipelines.yml&lt;/strong&gt; file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Now you need to make some edit in above file to make it work and for that you need to update the value for &lt;strong&gt;AWS_DEFAULT_REGION&lt;/strong&gt; and  &lt;strong&gt;S3_BUCKET&lt;/strong&gt;, these values can be found in your S3 bucket page. In below image I have marked where you can find those values, copy/paste these values into the above file. Log in to your aws account and moved to S3 bucket that you created in step 1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FFf8hHLC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FFf8hHLC.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Push code to Bitbucket, and check the live running app
&lt;/h2&gt;

&lt;p&gt;Finally we're in the last step. Commit your &lt;strong&gt;bitbucket-pipelines.yml&lt;/strong&gt; file and push it to the &lt;strong&gt;master branch&lt;/strong&gt;. After pushing your code to master branch move to Pipelines page and look for your pipeline status it will be &lt;strong&gt;In progress&lt;/strong&gt; after it changes to &lt;strong&gt;Successful&lt;/strong&gt; you can go and check your live vuejs app up and running on aws S3. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FwrB8p13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FwrB8p13.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you don't know the site URL you can check the step 1 where I have mentioned where you can find the &lt;strong&gt;URL Endpoint&lt;/strong&gt; for your S3 bucket.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article we created S3 bucket and IAM user on AWS and successfully setup bitbucket pipelines for continuous deployment of vuejs app to Amazon S3.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>devops</category>
      <category>aws</category>
      <category>bitbucket</category>
    </item>
  </channel>
</rss>
