DEV Community

Cover image for AWS Proton Tutorial - First Look
Mubbashir Mustafa
Mubbashir Mustafa

Posted on • Updated on

AWS Proton Tutorial - First Look

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


During re-invent 2020, 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

Step 1: Connect Github with your AWS Account

  • Go to AWS Proton Console

  • Click the hamburger menu to expand the sidebar
    AWS Proton Tutorial

  • Click "Source connections"
    AWS Proton Tutorial

  • It will take you to a new page, from there select "Create connection"
    AWS Proton Tutorial

  • Select "github" as a provider, give any name as "Connection name" and click "Connect to Github"
    AWS Proton Tutorial

  • From the popup, select "Authorize AWS Connector for Github"
    AWS Proton Tutorial

  • Once authorized, it will redirect you back to AWS. From there select "Install a new app"
    AWS Proton Tutorial

  • 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

  • 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

  • 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

  • After the app has been connected successfully with your AWS it will take you to app list page
    AWS Proton Tutorial

 

Step 2: Create "Account Roles"

  • From the AWS Proton Console, click "Account Roles" and then click "Create"
    AWS Proton Tutorial

  • 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

 

Step 3: Create "Environment template"

  • From the AWS Proton Console, click "Environment templates" from the left sidebar
    AWS Proton Tutorial

  • Click "Create environment template"
    AWS Proton Tutorial

  • Select "Use one of our sample template bundles" and choose "fargate-environment" as "Sample template bundle"
    AWS Proton Tutorial

  • Enter any name as "Template name" and "Template display name" and click "Create environment template"
    AWS Proton Tutorial

  • After creating the template, you need to select the minor version (1.0 in this example) and click "Publish"
    AWS Proton Tutorial

 

Step 4: Create "Service template"

  • From the left sidebar, select "Service templates" and then click "Create service template"
    AWS Proton Tutorial

  • Select "Use one of our sample template bundles" and "fargate-service" as "Sample template bundle"
    AWS Proton Tutorial

  • 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

  • Just like before, select the minor version and click "Publish"
    AWS Proton Tutorial

 

Step 5: Create Service"

  • Select "Services" from the left sidebar and then click "Create Service"
    AWS Proton Tutorial

  • Select the service template we created earlier (Hello World in my case) and click "Configure"
    AWS Proton Tutorial

  • 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
    AWS Proton Tutorial

  • Click "Add new instance"
    AWS Proton Tutorial

  • 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

  • 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

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.

 

Step 6: Take a Test Drive"

  • Once the status has been changed to "Succeeded", click on the instance name
    AWS Proton Tutorial

  • Copy the URL
    AWS Proton Tutorial

  • See the results
    AWS Proton Tutorial

  • Let's change the code and see CI/CD in action
    AWS Proton Tutorial

  • Once the changes have been deployed, reload the page
    AWS Proton Tutorial

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


Let's connect:

Linkedin: https://www.linkedin.com/in/mubbashir10/

Twitter: https://twitter.com/mubbashir100

Top comments (4)

Collapse
 
ictsingapore profile image
ict-singapore

thanks for the wonderful write up on Proton. Got 2 questions :

  1. In step 4 when you create Service template , you choose fargate in the compatible environment template, however , in the earlier step when you created the environemnt template, there was no template named fargate to choose from

  2. When i finish creating templates and configure service custom settings , i do not see any Add new instance in Load Balanced service input. I have You do not have any environments compatible with this service. Please create a compatible environment.

Not sure where this is an error , could you guide me to the right steps

Collapse
 
mubbashir10 profile image
Mubbashir Mustafa

Thanks for the appreciation.

  1. Yeah I accidentally selected the environment that I created against another environment template. It should be the one you created (Template Display Name in step 2). So in my case, it should be "Staging"

  2. It is also tied to point#1 ☝🏽 and should be fixed if you select an appropriate compatible environment


I will also update the screenshots

Collapse
 
mubbashir10 profile image
Mubbashir Mustafa

I have updated.

Thread Thread
 
ictsingapore profile image
ict-singapore

Thanks for the prompt action. Tried the steps and works brilliantly.