Using Amazon Alexa to Perform Voice Activated CI/CD Build and Deployments
The course is part of this learning path
Are you interested in learning how to apply Amazon Alexa Skills to common development tasks?
This course explains and demonstrates how to automate the process of building, testing, and deploying a Java project to the cloud using Amazon Alexa Skills with Continuous Integration and Continuous Delivery (CI/CD).
This content will help you gain an understanding of core CI/CD concepts. We start by covering aspects of CI/CD process automation using tools provided by AWS, Jenkins, Blue Ocean and Maven. We then gain the skills needed to automate the process of building, testing, and deploying a Java project to the cloud using Amazon Alexa Skills. We learn how to do this by integrating the Alexa Skills Kit (ASK) with AWS services like Lambda and Elastic Beanstalk.
- Recognize and explain core concepts of Continuous Integration and Continuous Delivery (CI/CD)
- Recognize and work with Jenkins Pipeline and Blue Ocean
- Extend Amazon Alexa by developing a custom Alexa Skill using the Alexa Skills Kit (ASK)
- Integrate Alexa with other AWS services like Lambda and Elastic Beanstalk
Software Developers, Build and Release Engineers, Alexa Enthusiasts.
To get the most from this content we recommend you have an understanding of the following areas
- Basic knowledge of the principles of software engineering and development
- Basic knowledge of Amazon Web Services (AWS) and an AWS account
- Basic knowledge of Continuous Integration/Continuous Delivery (CI/CD)
- Basic knowledge of the Alexa Voice Service (AVS)
We welcome all feedback on content please reach out to us at firstname.lastname@example.org with any questions or comments.
Now that we've explored all the components of DevOps Pal, let's talk more about the DevOps software development approach and more specifically continuous integration and continuous delivery, CI/CD. Consider an assembly line in an automobile assembly plant that produces a car. Each step is reproducible. The same holds true for a software delivery pipeline. Each step is reproducible. CI/CD seeks to automate the software delivery pipeline in a reproducible way. CI/CD is the practice of continuously building, testing and deploying code once it's committed to version control and serves as the bridge between the development team and the operation's team. DevOps and and CI/CD provide software engineering teams with confidence in the code being pushed to production and shorter development lifecycles which in the end produces happier users, clients and customers. Let's walk through the Java API project stored in GitHub.
The source code for the spring base Java API is stored in the Alexa controller dot Java file so let's go there. Click on source, main, Alexa CI/CD and then Alexa controller. So this is a very simple rest controller. You see here on line seven, I'm annotating it with the at rest controller annotation which makes it a restful API and there's one method called message here on line 10 and its accessed via the message request mapping as defined here on line nine and it returns the message passed in and stored in the text attribute or it just defaults to hello world. Now let's go back and look at the Jenkins build file. So that's at the main root directory level and let's click on the Jenkins file. So this is the Jenkins build file that's created using the Jenkins Blue Ocean interface. So let's look at Jenkins Blue Ocean. Let's walk through the setup of the Jenkins pipeline via the Blue Ocean interface. So I've logged in to Jenkins and I'm going to click on open Blue Ocean. Now, this option is enabled via the Blue Ocean plug-in. This brings me to the pipeline page. Notice I've created one pipeline called Alexa CI/CD. Let's click on it. This page shows the activity for all of the pipeline runs. So let's click on the first one. Notice there are four stages initialize, build, test and deploy. So let's look at each stage in more detail. I'm clicking on the edit icon. So first, let's click on the initializing stage. So notice I'm printing a simple message that says starting the pipeline and then I'm running the Maven Clean command via a shell script. So that's initialized. Let's take a look at the build. So when I click on build I notice I'm calling a shell script here and it's running the Maven Install command. The next is a test. So this is another shell script and all it does, it runs the Maven Test command. And lastly, let's look at deploy. This deploy step uses the AWS CLI on the Jenkins server to deploy the Java project code to AWS Elastic Beanstalk. First, I'm archiving the artifact, the dot war file in this case.
The next step, I'm running the shell script and this copies the artifact, the war file, to the AWS S3 bucket. S3 is a file storage system for the Cloud. And the next step, the second shell script, I'm creating a new Beanstalk application version based on the war file located on S3. And lastly I'm updating the Beanstalk environment to create the new application version. So let's look at an example run. So here, the code is being checked out from version control. I'm printing a message starting the pipeline and then I'm running Maven Clean. Build, I'm running the Maven Install command and this shows the output. I'm running the test. And then I'm deploying. So it shows the output of the S3 copy, the output of creating the new application version and the output of updating the Beanstalk environment with the new application version. Let's walk through the Java API running on AWS Elastic Beanstalk and test it via Postman. I've launched the AWS Elastic Beanstalk console. Let's review the one application Alexa CI/CD that I have set up here. So now behind the scenes, Elastic Beanstalk has orchestrated the set up of EC2, Tomcat running Java 8 of VPC, load balancer security groups, etcetera. So the application is up and running and you can access it via a URL. So now let's look at the application versions. So on this page, we're able to see all of the automated deployments from Jenkins.
I've labeled each version with a static label and a Jenkins build number. So here we see the latest Jenkins build number is 59. And if we scroll all the way down, notice the initial deployment wasn't deployed through Jenkins. It's something I did manually. So I really appreciate now having Jenkins deploy my code for me. Now we've seen already through Postman we can test the API and receive a response of hello world. There's also a feature where you can send in a custom message and get that message back instead of hello world. So, in this case, I'm sending in a text, Alexa is a real person. So let's click send, and as expected we get the response back, Alexa is a real person. Now that we've been introduced to CI/CD concepts, let's talk more about Alexa and how she works.
About the Author
Kesha Williams (pronounced KEY-SHA) is an award-winning software engineering manager with over 20 years’ experience. She's passionate about emerging technologies, speaking, teaching, and mentoring. She's trained thousands of software engineers in the US, Europe, and Asia while teaching at the university level. She routinely leads innovation teams in proving out emerging technologies and shares her learnings at technical conferences around the globe. She recently won the Ada Lovelace Award in Computer Engineering from Look Far and the Think Different Innovation Award from Chick-fil-A for her work with Artificial Intelligence (AI). She was recently featured in Amazon's "Alexa Women of Voice" campaign and named an Alexa Champion. In her spare time, she leads the Georgia chapter of Technovation, writes news for InfoQ, authors video courses, and mentors women in tech.
To learn more about me, visit my website at http://www.kesha.tech