AWS Proton is a complete delivery service for containerized and serverless applications. It provides tools to provision infrastructure, and deploy, manage, and update services.
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, AWS made a couple of announcements related to containerization service offerings. Which are:
🔥 Four new services:
📦 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
Go to AWS Proton Console
Click the hamburger menu to expand the sidebar
Click "Source connections"
It will take you to a new page, from there select "Create connection"
Select "github" as a provider, give any name as "Connection name" and click "Connect to Github"
From the popup, select "Authorize AWS Connector for Github"
Once authorized, it will redirect you back to AWS. From there select "Install a new app"
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)
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"
Once you have given the access, it will take you back to AWS and fill in the app field for you - click "Connect"
After the app has been connected successfully with your AWS it will take you to app list page
From the AWS Proton Console, click "Account Roles" and then click "Create"
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)
From the AWS Proton Console, click "Environment templates" from the left sidebar
Click "Create environment template"
Select "Use one of our sample template bundles" and choose "fargate-environment" as "Sample template bundle"
Enter any name as "Template name" and "Template display name" and click "Create environment template"
After creating the template, you need to select the minor version (1.0 in this example) and click "Publish"
From the left sidebar, select "Service templates" and then click "Create service template"
Select "Use one of our sample template bundles" and "fargate-service" as "Sample template bundle"
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"
Just like before, select the minor version and click "Publish"
Select "Services" from the left sidebar and then click "Create Service"
Select the service template we created earlier (Hello World in my case) and click "Configure"
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
Click "Add new instance"
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"
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
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.
Once the status has been changed to "Succeeded", click on the instance name
Copy the URL
See the results
Let's change the code and see CI/CD in action
Once the changes have been deployed, reload the page
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