In this tutorial, you'll learn how to deploy a serverless SAM Python application (CI/CD) using GIT, AWS Code Commit, AWS Code Build, AWS Code Pipeline, PyCharm, SAM Build, SAM Deploy & buildspec.yml.
https://docs.aws.amazon.com/serverles...
—
Facebook: / gokcedbsql
—
Video Transcript:
_
Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn how to deploy a serverless Sam application using AWS code and AWS code pipeline. Let's start by navigating to the code commit service then click on create a repository and give it a name.
Hit create then clone this repository to your local machine using git clone. Next, I'm going to use pie charm to create a new AWS serverless project inside my Repository. Choose Python for runtime then hit create from existing sources.
Give it a few minutes for the project files to get created then click on the configuration drop-down and hit edit. Choose the hello world template as your input then hit run. Looks like our Sam application is working as expected since we see the hello world message in the console output.
Next, click on the terminal tab then type Sam build followed by Sam deploy hyphen hyphen guided. Follow the prompts to set the configuration for Sam to deploy then wait for the deployment to complete. After the application is deployed you should see an API Gateway endpoint URL in the deployment logs.
Click on this URL and you should see a hello world message which means our application was successfully deployed. Next, I'm going to create a build Spec dot EML file which we will need when we deploy this application using Code deploy. Now, let's commit and push all our projects to our code commit Repository.
Let's head back to the code commit where we see all these files in our my Sam repo. Next, click on build project under code build then click on create build project. Give your build project a name then specify my Sam repo as your code commit source.
Select the master Branch then choose Amazon Linux 2 as the Operating System for the managed image. Select the standard for runtime then pick an image. I'm going to copy the name of the new service role because we'll need it to add more permissions later.
For build specify build spec.aml then hit create. Next, let's navigate to the IAM service, then find the service role that we just copied. Go inside this role then click on ADD permissions then attach policies.
I'm going to give this role full access to IAM S3, Cloud watch, API Gateway, Cloud formation, and Lambda. Next, click on start build then hit tail logs. Give it a few minutes and if there are no errors in the build logs, You should see the succeeded message.
Now, let's create a code pipeline. Click on pipeline then hit create. Give your pipeline a name, hit next then choose AWS code commit as your source provider. Select your repository and the master Branch then click on next.
Choose AWS code as the build provider then select my Sam to build the project and hit next. I'm going to skip the deploy stage because we are running Sam's deploy build step. Hit create Pipeline and your Pipeline should start getting executed automatically.
Give it a few minutes for your source code to check out then the pipeline automatically kicks off the code build step. To look at your build logs click on details in the build step then hit tail logs.
Wait for a few minutes for the build to complete and if there are no errors you should see the succeeded message.
Next, let's edit our app.py file and change the output message to hello world dash version 2. Let's commit and push this change to our remote Master Branch.
Let's head back to the code pipeline window to see if our code pipeline automatically picks up this change and starts a new execution.
Looks like a new build is now in progress. Let's click on details and tell the build logs.
Give it a few minutes for the build to complete then grab the API endpoint URL. Looks like our change was successfully deployed.
There you have it. Make sure you like, subscribe, and turn on the notification bell. Until next time.
Смотрите видео How To Deploy Serverless SAM Using Code Pipeline (5 Min) | Using AWS Code Build & Code Commit онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Gokce DB 18 Декабрь 2022. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 3,772 раз и оно понравилось 61 посетителям.