AWS Proton Tutorial - First Look
Tags: aws, devops, docker, tutorial
Published: 2020-12-04 06:29:13

---
series: Containers on AWS
---
AWS Proton is a complete delivery service for containerized and serverless applications. It provides tools to provision infrastructure, and deploy, manage, and update services.

***
#### UPDATE (Jun 9, 2021): 
AWS Proton is no longer a preview service and it is available generally. [Read the announcement] (https://aws.amazon.com/about-aws/whats-new/2021/06/aws-announces-the-general-availability-of-aws-proton/)
***

During [re-invent 2020](https://reinvent.awsevents.com/),  AWS made a couple of announcements related to containerization service offerings. Which are:

**🔥 Four new services:** 
- AWS Proton (a new service to manage and automate container development and deployment)
- Amazon ECS Anywhere (run ECS on-premises environments)
- Amazon EKS Anywhere (run EKS on-premises environments)
- Amazon ECR Public - (host and share public repos just like DockerHub)

**📦 Containerization Comes to Lambda:** 
You can now package and deploy AWS Lambda functions as a container image of up to 10 GB

In this tutorial, I am going to show how you can take a test drive of AWS proton and deploy your first app on it. 

**ℹ️ Notice: It's a preview program and not 100% stable at the time of writing**

**ℹ️ Notice: Make sure your AWS account has "Administrative access" before proceeding (root accounts have it by default).**

**ℹ️ Notice: If you don't have ECS experience then I will highly recommend you to [complete this series first](https://dev.to/mubbashir10/deploy-your-react-app-to-ecs-fargate-38p9)**

#### Step 1: Connect Github with your AWS Account
- Go to [AWS Proton Console](https://console.aws.amazon.com/proton/)

- Click the hamburger menu to expand the sidebar
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/nyfias6io4q3o1z1klx0.png)

- Click "Source connections"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/s0bxovl3zu80919r1yup.png)

- It will take you to a new page, from there select "Create connection"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/ipryzfmb4k379iuhiua1.png)

- Select "github" as a provider, give any name as "Connection name" and click "Connect to Github"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/6ctdrd6t1au0vouadfiy.png)

- From the popup, select "Authorize AWS Connector for Github"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/48bs07i27vlf6eycw5sr.png)

- Once authorized, it will redirect you back to AWS. From there select "Install a new app"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/f4we5eoastk9ljbj8yje.png)

- It will take you to GitHub (again) and will ask for the organization where you would like to install the app (in my case I am going to do it on my personal organization)
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/fpio10lzz4g8hrtm38rk.png)

- After that, select the repositories you would like to give the connector app access to (I am going to give it access to all of my repos) and then click "Install"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/prn7t9rn3vb4901ampu3.png)

- Once you have given the access, it will take you back to AWS and fill in the app field for you - click "Connect"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/ml9utcfm4mkxita9lgpq.png)

- After the app has been connected successfully with your AWS it will take you to app list page
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/zn3kt9547sglc7hbcszt.png)

&nbsp;
#### Step 2: Create "Account Roles"
- From the [AWS Proton Console](https://console.aws.amazon.com/proton/), click "Account Roles" and then click "Create"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/y887kz5b5fcvbgsasnd3.png)

- Select "New service role", give any name, check "`I agree to create Proton role...`" option, and click "Create" (you are seeing "Update" in the screenshot 'cause I already have a service role created)
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/gjc6nmziylqw5t5dl3dq.png)

&nbsp;
#### Step 3: Create "Environment template"
- From the [AWS Proton Console](https://console.aws.amazon.com/proton/), click "Environment templates" from the left sidebar
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/5x1qx30pyah0408qc6rf.png)

- Click "Create environment template"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/yo0osxl52bzwbtxvw9om.png)

- Select "Use one of our sample template bundles" and choose "fargate-environment" as "Sample template bundle"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/prsz03miy7a709b76xi3.png)

- Enter any name as "Template name" and "Template display name" and click "Create environment template"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/t2w59x85gvlu2o4a2u81.png)

- After creating the template, you need to select the minor version (1.0 in this example) and click "Publish"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/9zh721hs3krm2vhzzkch.png)

&nbsp;
#### Step 4: Create "Service template"
- From the left sidebar, select "Service templates" and then click "Create service template"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/qay7ue7dkkklwg23vsl8.png)

- Select "Use one of our sample template bundles" and "fargate-service" as "Sample template bundle"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/bk513n12s0l0rhtf5b1p.png)

- Enter any name as "Template name" and "Template display name", select "Staging" as the compatible environment template (it should be the same as "Template display name" in step 2 ☝🏽), and click "Create service template"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/tpn9n5npc8ilfvd7ubgk.png)

- Just like before, select the minor version and click "Publish"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/l184m28cpofxuft67s5r.png)

&nbsp;
#### Step 5: Create Service"
- Select "Services" from the left sidebar and then click "Create Service"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/ey2yczxaeq1w3v9gv6e6.png)

- Select the service template we created earlier (Hello World in my case) and click "Configure"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/3wedrdo2mjlgcgt4itbo.png)

- Give any name to "Service Name", enter the branch (of your Github repo) name you would like to use, enter your repo id in the format `account-id/repo-name`, select the github connection we created in step 1 and then click "Next" - [you can also fork this sample app if you don't have any](https://github.com/mubbashir10/aws-proton-nodejs-sample)
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/7orch0r5glpb8dxgbr3y.png)

- Click "Add new instance"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/z14syrjlf0yx2gvxii3c.png)

- Give a name to your instance, selected the environment we created earlier, give a port number (default is 80), set the desired count to 1 (it's literally the same as setting the number of tasks in ECS), select X-small as size (I tried looking for some reference for these sizes and how they map to vCPUs/memory but I couldn't find in the official doc at the time of writing this article), give any name to "Unique name", click "Create"
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/igjgvm5r5chaetmb6miw.png)

- Once the service has been created, it will take you to the service page and in the bottom section you can see all the instances of that particular service
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/5qrtppe2xa6xegax06uh.png)

It will take a while before the status is changed to "Succeeded" from "In Progress". Actually, behind the scenes, it will create an ECS cluster, service, task def, task, cloud build project, cloud pipeline, etc.

&nbsp;
#### Step 6: Take a Test Drive"
- Once the status has been changed to "Succeeded", click on the instance name
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/zb2xz9s0jnqq7j3fjmyo.png)

- Copy the URL 
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/48rlcg2ja805kczlvuc7.png)

- See the results
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/3jhf8rdz9tzws9dba4xp.png)

- Let's change the code and see CI/CD in action
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/5w8jxcyipc846w7l19bo.png)

- Once the changes have been deployed, reload the page
![AWS Proton Tutorial](https://dev-to-uploads.s3.amazonaws.com/i/58d0jn0zyxmk6gerpjrg.png)


That's it, thank you so much for following along!

**🐞 Bugs and their workarounds**
When I first tried AWS Proton there were a number of bugs that I found, most of them have already been fixed and chances are when you are reading this the remaining ones are also fixed

- By default, it was always going to Nginx image and I had to get the URI of my image from ECR and then update the service instance manually (actions->update specs)

- Sometimes it wouldn't show me "Use one of our sample template bundles", for that go to AWS Proton console, click get started, and from there click "Create environment template"

- If the pipeline failed it wouldn't give any error and the status of the instance would show "in progress". To fix that, go to AWS Pipeline and see at which stage it has failed and why and fix it (you can also access the associated code build project from there)

- I couldn't update/delete failed pipelines even after using the CLI so you can manually delete it by going to ECS and removing/stopping associated service or task(s) - [see the Github issue](https://github.com/aws/aws-proton-public-roadmap/issues/26)

---
Let's connect: 

Linkedin: [https://www.linkedin.com/in/mubbashir10/](https://www.linkedin.com/in/mubbashir10/) 

Twitter: [https://twitter.com/mubbashir100](https://twitter.com/mubbashir100)