<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by David Spenard on Medium]]></title>
        <description><![CDATA[Stories by David Spenard on Medium]]></description>
        <link>https://medium.com/@dspenard?source=rss-39209af5a795------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lOpGcaTlaV0gWRLihNja9Q.png</url>
            <title>Stories by David Spenard on Medium</title>
            <link>https://medium.com/@dspenard?source=rss-39209af5a795------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:22:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dspenard/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating Conversational AI Agents with Azure AI Foundry]]></title>
            <link>https://medium.com/doit-international/creating-conversational-ai-agents-with-azure-ai-foundry-785bf15d366f?source=rss-39209af5a795------2</link>
            <guid isPermaLink="false">https://medium.com/p/785bf15d366f</guid>
            <category><![CDATA[azure-ai-studio]]></category>
            <category><![CDATA[ai-agent-development]]></category>
            <category><![CDATA[azure-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[David Spenard]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 09:01:34 GMT</pubDate>
            <atom:updated>2025-09-23T18:18:14.155Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Omylhh_Lc77TESBb-uaIOg.jpeg" /><figcaption>Photo by <a href="https://www.shutterstock.com/g/Wanan+Yossingkum">Wanan Wanan</a> from Shutterstock</figcaption></figure><h3><strong>Introduction</strong></h3><p><a href="https://azure.microsoft.com/en-us/products/ai-foundry">Microsoft’s Azure AI Foundry</a> simplifies AI development by providing a unified platform for building, deploying, and managing intelligent applications. It serves as your AI development hub, combining language models, data management, and deployment tools in a single environment. It abstracts the complexity of AI development while maintaining the flexibility developers need for sophisticated solutions.</p><p>We’ll start with a basic chat interaction to understand the foundational conversation capabilities of a large language model. Then we’ll explore <a href="https://azure.microsoft.com/en-us/products/ai-agent-service/">Azure AI Foundry Agent Service</a>, where specialized agents can be created to handle specific tasks, maintain conversation context, and integrate with external data sources.</p><p>I’ll show how to quickly create a basic agent that relies solely on its training data, and then an enhanced version incorporating additional knowledge sources for more accurate responses. Finally, we’ll demonstrate a practical Python code example showing how to integrate these agents directly into your applications for scalable, intelligent solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/0*zTNAav2tvqP_9O5s" /><figcaption>Azure AI Foundry Ecosystem</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pIXezPEgrH0xxT59" /><figcaption>AI Agent Components</figcaption></figure><h3><strong>Azure Portal</strong></h3><p>For this example, we will perform a standard setup of Azure AI Foundry and an Agent Service using the Azure Portal. The prerequisites to get started merely involve a few permissions after you access your Azure subscription.</p><ul><li>Get access to an Azure subscription, and you can <a href="https://azure.microsoft.com/en-us/pricing/purchase-options/azure-account?cid=msft_learn-exp1">start for free</a>.</li><li>Ensure you have the <a href="https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal"><strong>Azure AI Account Owner</strong></a> and <strong>Azure AI Project Manager</strong> roles at the subscription scope.</li><li>If configuring an Azure AI Foundry <a href="https://learn.microsoft.com/en-us/azure/ai-foundry/agents/environment-setup#choose-your-setup">standard setup</a>, ensure you have permissions to assign roles to any required resources (Cosmos DB, Azure AI Search, Azure Blob Storage). For more information on RBAC roles, specific to the Azure AI Foundry Agent Service, see <a href="https://learn.microsoft.com/en-us/azure/ai-foundry/concepts/rbac-azure-ai-foundry">Azure AI Foundry Agent Service RBAC roles</a>. The built-in role needed is <strong>Role Based Access Administrator</strong>, which provides the key permission Microsoft.Authorization/roleAssignments/write</li><li>If you encounter errors about missing registrations or unregistered providers, then you must <a href="https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types">register the provider</a> mentioned in the error message.</li></ul><h4>Deploy the Project and basic AI Agent</h4><p>Use this custom deployment template to provision the necessary Azure AI Foundry project and agent.</p><pre>https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fazure-ai-foundry%2Ffoundry-samples%2Frefs%2Fheads%2Fmain%2Fsamples%2Fmicrosoft%2Finfrastructure-setup%2F40-basic-agent-setup%2Fbasic-setup.json</pre><p>This launches in the Azure portal and creates an <a href="https://learn.microsoft.com/en-us/azure/ai-foundry/what-is-azure-ai-foundry#work-in-an-azure-ai-foundry-project">Azure AI Foundry project</a> where you can work in an independent environment to quickly explore your AI ideas, build prototypes, and more.</p><p>Select the subscription and resource group, fill in the other fields, including location, and leave all the model-related fields untouched. This provides the details for creating the project and deploying a <a href="https://learn.microsoft.com/en-us/azure/ai-foundry/openai/concepts/models?tabs=global-standard%2Cstandard-chat-completions">GTP-4o model</a>.</p><p>Click the ‘Review + create’ button to deploy the template. It will take a few minutes to complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*aBcAPZ_oZgWmN9qa" /><figcaption>Deployment template form to create Azure AI Foundry resources</figcaption></figure><p>Click ‘go to resource group’ when the deployment is done to view the resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4SaGnKga23HJTUx4" /><figcaption>Resource Group showing deployed Project</figcaption></figure><p>If you click on the project link, you can go to the <a href="https://ai.azure.com/">Azure AI Foundry portal</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lJGl79TZym-3Ft0Z" /><figcaption>Link to go to the project</figcaption></figure><h3>Azure AI Foundry Portal</h3><h4>Chat with the model</h4><p>Once you access the Azure AI Foundry portal, if it doesn’t take you directly to the Playground for your project, select the project name from the main page and then select Playgrounds. This will select the gpt-4o deployment for you, where you can begin chatting with the model. Try a few prompts and see what you get. And maybe try out different model instructions, or restrict answers to a certain topic, or add a data source to supplement the model with your data.</p><p>For example, I instructed the model to only provide answers about earthquakes, and then I asked for a recipe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UD230cw6MtazAIH9" /><figcaption>Chat playground with sample model instructions</figcaption></figure><h4>Deploy chatbot as a web app</h4><p>One cool feature is deploying a simple chatbot as a web app. It will take quite a few minutes to deploy, and then you can click the link to open the web app and try it out. Note that there is much to be desired here to make something like this production-ready, but this demonstrates how easy it is to create a basic chat web app.</p><p>Next to the ‘View code’ button at the top of the Chat playground interface, select ‘Deploy as web app’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/0*hnGLjTwqpjJvs_Oq" /><figcaption>Deploy chatbot as a web app</figcaption></figure><p>To launch the web app after it deploys, go to ‘My assets/Web apps’ and click the link for the deployed web app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*1qWDaB4dp-8VDi1aeHTagQ.png" /><figcaption>Launch web app</figcaption></figure><p>If you notice in the Chat playground, when I provided instructions to the model, I restricted its answers to only questions about earthquakes. As you can see in the chat interface in the web app, the model failed to tell me a joke, but it did answer an earthquake question. However, the model was only trained on data up to October 2023, so in the next section, I’ll show you how to supplement the model with a custom data source without any need to retrain it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AB-p_eUTUmb4mHtW" /><figcaption>Chatbot web app example</figcaption></figure><h4>Use an agent to chat with the model</h4><p><strong>Creating a simple agent</strong></p><p>Now that you have a good understanding of how chatting with a model works, let’s enhance this with an agent that wraps this functionality. Then, we’ll supplement the model’s knowledge with a custom data source and then call this agent via a simple Python example.</p><p>Select ‘Agents/New Agent’ to create a new agent. Provide an agent name and set of instructions. The instructions are required, and they should be specific to what an agent should do, and in this case, it will be an agent that can only answer questions about earthquakes. You can leave the Deployment as the default gpt-4o, and the Temperature and Top P defaults are fine as they are. Agent configuration changes are auto-saved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3PhHPTuIOzwmyi1M4jkZ1w.png" /><figcaption>Agent configuration for chatting about earthquakes</figcaption></figure><p>If you click the ‘Try in playground’ button, you can test out the agent the same way you chatted directly with the model previously.</p><p><strong>Supplementing the agent with additional knowledge</strong></p><p>Azure AI Foundry offers multiple options for integrating custom data into your AI applications and services. It is beyond the scope of this article, but more information is available <a href="https://learn.microsoft.com/en-us/azure/ai-foundry/how-to/data-add">here</a>.</p><p>As a simple example, I’ll be adding one PDF file as a data source to provide my agent with more knowledge about earthquakes. I downloaded a PDF copy of the Wikipedia page on the 2025 Kamchatka Peninsula earthquake, which you can download <a href="https://drive.google.com/file/d/1GlMbRWbaZZ7dAg1FLNwarIeItJvMJFZ6/view">here</a> if you want to follow along and use it in your agent.</p><p>Once you have the PDF file, click the ‘+Add button’ for Knowledge in the Agent configuration, then select ‘Files’ to upload the file. You can leave the defaults as-is to create a new vector store, then select ‘Upload and save’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zCjzhk7MGp-V98rXe_6Szw.png" /><figcaption>Uploaded PDF file to supplement the agent with additional earthquake knowledge</figcaption></figure><p>If you click the ‘Try in playground’ button again, this time you can ask about the July 2025 earthquake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mSR5ar1sM5xoQ9TbHZ9TZQ.png" /><figcaption>Chat with agent after a data source was added</figcaption></figure><h3>Python example to call the agent</h3><p>Now that you have a good understanding of how a basic Agent works in Azure AI Foundry, let’s try out some Python code to hit the model endpoint directly. But first, get a copy of the Azure AI Foundry project endpoint from the Overview page, and the Agent ID from the Agent page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Tf793loYXO-hTLjUbpEWA.png" /><figcaption>Overview page showing Azure AI Foundry project endpoint</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtJKqBFV5yf0tfapQcsfPw.png" /><figcaption>Agent page showing the Agent ID</figcaption></figure><p>Copy this source code locally to a file named agent_earthquake_chat.py. It’s a simple, silly Python example that is not production-friendly by any means :)</p><pre>from azure.ai.projects import AIProjectClient<br>from azure.identity import DefaultAzureCredential<br>from azure.ai.agents.models import ListSortOrder<br><br>import os<br><br>endpoint = os.getenv(&quot;AZURE_FOUNDRY_ENDPOINT&quot;)<br>agent_id = os.getenv(&quot;AZURE_FOUNDRY_AGENT_ID&quot;)<br><br>if not endpoint or not agent_id:<br>    raise EnvironmentError(&quot;AZURE_FOUNDRY_ENDPOINT and AZURE_FOUNDRY_AGENT_ID must be set in your environment.&quot;)<br><br>project = AIProjectClient(<br>    credential=DefaultAzureCredential(),<br>    endpoint=endpoint)<br><br>agent = project.agents.get_agent(agent_id)<br><br>thread = project.agents.threads.create()<br>print(f&quot;Created agent thread, ID: {thread.id}&quot;)<br>print(&quot;Type &#39;quit&#39; to exit the chat.&quot;)<br><br># Initial message<br>message = project.agents.messages.create(<br>    thread_id=thread.id,<br>    role=&quot;user&quot;,<br>    content=&quot;Hi Agent&quot;<br>)<br><br>run = project.agents.runs.create_and_process(<br>    thread_id=thread.id,<br>    agent_id=agent.id)<br><br>if run.status == &quot;failed&quot;:<br>    print(f&quot;Run failed: {run.last_error}&quot;)<br>else:<br>    messages = project.agents.messages.list(thread_id=thread.id, order=ListSortOrder.ASCENDING)<br>    for message in messages:<br>        if message.text_messages:<br>            print(f&quot;{message.role}: {message.text_messages[-1].text.value}&quot;)<br><br># Chat loop<br>while True:<br>    user_input = input(&quot;You: &quot;).strip()<br>    if user_input.lower() == &quot;quit&quot;:<br>        print(&quot;Conversation ended. See you next time.&quot;)<br>        break<br><br>    # Add user message<br>    project.agents.messages.create(<br>        thread_id=thread.id,<br>        role=&quot;user&quot;,<br>        content=user_input<br>    )<br><br>    # Run agent again<br>    run = project.agents.runs.create_and_process(<br>        thread_id=thread.id,<br>        agent_id=agent.id)<br><br>    if run.status == &quot;failed&quot;:<br>        print(f&quot;Run failed: {run.last_error}&quot;)<br>        continue<br><br>    # Display latest response<br>    messages = list(project.agents.messages.list(thread_id=thread.id, order=ListSortOrder.ASCENDING))<br>    for message in reversed(messages):<br>        if message.role == &quot;assistant&quot; and message.text_messages:<br>            print(f&quot;Agent: {message.text_messages[-1].text.value}\n&quot;)<br>            break</pre><p>Here are step-by-step instructions and commands to run your script in an isolated Python environment, ensuring no reliance on global packages.</p><ol><li>While in the same folder as the source code downloaded, create a virtual Python environment:</li></ol><pre>python3 -m venv foundry-env</pre><p>2. Activate the environment:</p><pre>source foundry-env/bin/activate</pre><p>3. Upgrade pip (recommended):</p><pre>pip install --upgrade pip</pre><p>4. Install required Azure dependencies:</p><pre>pip install azure-ai-projects azure-identity</pre><p>5. Set environment variables for Azure AI Foundry Agent with your specific values:</p><pre>export AZURE_FOUNDRY_ENDPOINT=&quot;https://foundryyizp.services.ai.azure.com/api/projects/foundry-demo-project&quot;<br>export AZURE_FOUNDRY_AGENT_ID=&quot;asst_ABCfRyUC7X4AenJN3wyRY7AJ&quot;</pre><p>6. Run your script:</p><pre>python agent_earthquake_chat.py</pre><p><strong>Example chat via Python</strong></p><pre>(foundry-env) david@Mac azure-ai-foundry % python agent_earthquake_chat.py<br>Created agent thread, ID: thread_Y9FxpLWwVELeY3wlNoE1K6ez<br>Type &#39;quit&#39; to exit the chat.<br>MessageRole.USER: Hi Agent<br>MessageRole.AGENT: Hello! How can I assist you with earthquake-related information today?<br>You: What is Azure AI Foundry?<br>Agent: I&#39;m here to assist with earthquake-related information only. Let me know if you have any questions about earthquakes!<br><br>You: What was the tsunami impact of the July 2025 earthquake not far from Russia?<br>Agent: The July 2025 earthquake off the coast of Kamchatka, Russia, had widespread tsunami impacts. Tsunami waves reached heights of up to 15 meters in some Russian regions, causing local panic and destruction, particularly in Severo-Kurilsk, Komandorsky Islands, and nearby areas. Coastal regions as far as Hawaii, Alaska, and Japan observed increased wave activity, with localized alerts issued in the Pacific Rim. Evacuations were prompted in Japan and parts of the United States due to concerns of waves exceeding several meters in height【8:0†source】【8:1†source】【8:19†source】.<br><br>You: Give me 10 bullet points explaining what happens when an earthquake occurs.             <br>Agent: Here are 10 key points explaining what happens during an earthquake:<br><br>1. **Rupture at Fault Line**: Earthquakes begin when stress in Earth&#39;s crust surpasses the strength of the rocks, causing a sudden rupture along fault lines.<br><br>2. **Release of Energy**: This rupture releases a burst of energy in the form of seismic waves, propagating through the Earth.<br><br>3. **Seismic Waves Propagate**:<br>   - *Primary Waves (P-Waves)*: Travel fastest and move through solids, liquids, and gases.<br>   - *Secondary Waves (S-Waves)*: Slower than P-waves and cannot travel through liquids.<br><br>4. **Ground Shaking**: These seismic waves cause the ground to shake, with the intensity depending on the earthquake&#39;s magnitude and depth.<br><br>5. **Surface Displacement**: In some cases, visible breaks or shifts appear at the Earth&#39;s surface along the fault line.<br><br>6. **Aftershocks**: Smaller earthquakes occur as the crust adjusts to the changes caused by the mainquake.<br><br>7. **Tsunamis** (if under ocean): Submarine earthquakes displace water, potentially generating tsunamis that radiate outward.<br><br>8. **Landslides and Liquefaction**: Ground disturbances can lead to landslides or liquefaction of soils, which compromise stability in affected areas.<br><br>9. **Damage and Destruction**: Seismic activity damages buildings, infrastructure, and natural landscapes, depending on proximity and construction standards.<br><br>10. **Human Response and Resilience**: People respond with evacuations, rescue operations, and rebuilding efforts, adapting to the earthquake&#39;s aftermath. <br><br>Let me know if you&#39;d like details on any specific aspect!<br><br>You: quit<br>Conversation ended. See you next time!</pre><h3>Clean up Azure Resources</h3><p>The cost of the resources created in this exercise is very minimal, but you can expect to spend $1 or $2. After creating the project and experimenting with a few dozen prompts via the chat playground and Python example, my costs were under $3.</p><p>To clean up all the Azure resources used during the exercise, Azure makes it very simple for you. Back in the <a href="https://portal.azure.com/">Azure Portal</a>, navigate to Resource groups and select the resource group you created for this exercise, then select ‘Delete resource group’ to delete it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vR-mFu35lzCkgv2UwfvZXQ.png" /><figcaption>Delete resource group in the Azure Portal</figcaption></figure><h3>Summary</h3><p>We progressed from a basic chat interaction to building a specialized agent with external knowledge integration, concluding with a practical Python example for real-world implementation. Azure AI Foundry effectively bridges the gap between AI complexity and developer accessibility, providing the tools needed to build sophisticated, scalable, intelligent applications without getting overwhelmed by technical intricacies. There’s much more to discover with Azure AI Foundry beyond what I’ve covered here, and I hope this small sample of its capabilities provides the guidance and motivation you need to build amazing AI-enabled applications with Azure.</p><p>Whether it’s Generative AI and machine learning, cost optimization and infrastructure automation, or security hardening and cloud architecture design, DoiT International offers extensive expertise across multiple cloud domains. To explore how DoiT can help you implement AI and modernize other aspects of your cloud infrastructure, don’t hesitate to <a href="https://www.doit.com/contact/?utm_source=test&amp;utm_medium=topnavcontact&amp;utm_id=top_nav_contact_link">reach out</a> to learn about our cloud engineering solutions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=785bf15d366f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/doit-international/creating-conversational-ai-agents-with-azure-ai-foundry-785bf15d366f">Creating Conversational AI Agents with Azure AI Foundry</a> was originally published in <a href="https://medium.com/doit-international">DoiT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure AI Natural Language Understanding: From Text to Actionable Insights]]></title>
            <link>https://medium.com/doit-international/azure-ai-natural-language-understanding-from-text-to-actionable-insights-45c0d7b4a3ea?source=rss-39209af5a795------2</link>
            <guid isPermaLink="false">https://medium.com/p/45c0d7b4a3ea</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[azure-ai-services]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[David Spenard]]></dc:creator>
            <pubDate>Thu, 06 Feb 2025 12:01:35 GMT</pubDate>
            <atom:updated>2026-06-09T18:12:01.336Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y9QquS4AhQj5CiQbAXSv2Q.jpeg" /><figcaption>Photo by <a href="https://www.shutterstock.com/g/elnur">Elnur</a> from Shutterstock</figcaption></figure><h3>Introduction</h3><p>AI is undoubtedly transforming how applications are developed and how businesses operate today. As organizations race to leverage AI capabilities, Microsoft Azure has emerged as a powerful platform that democratizes access to advanced AI services. Through <a href="https://learn.microsoft.com/en-us/azure/ai-services/what-are-ai-services">Azure AI Services</a> (formerly Cognitive Services), application developers can now implement sophisticated AI features, such as natural language understanding or image recognition, without deep machine learning expertise or massive computational resources.</p><p>Numerous AI capabilities are available with Azure AI Services. This article will demonstrate one way to integrate AI into applications to seamlessly extract information, classify text, understand conversational language, answer questions, and more, using the <a href="https://learn.microsoft.com/en-us/azure/ai-services/language-service/overview">Azure AI Language Service</a>.</p><h3>Prerequisites</h3><ol><li><a href="https://azure.microsoft.com/en-us/pricing/purchase-options/azure-account">Azure account</a>, which is available for free up to 30 days if you do not have one.</li><li>Basic understanding of Azure and navigation in the <a href="https://portal.azure.com/">Azure portal</a>.</li><li>To execute the sample Python code, a basic understanding of <a href="https://www.python.org/">Python</a> and <a href="https://pypi.org/project/pip/">pip</a> is recommended, and access to Github is needed to download the <a href="https://github.com/doitintl/azure-ai-services-demo">sample code</a>.</li><li>Some knowledge of <a href="https://www.docker.com/">Docker</a> and application containerization is beneficial, as well.</li></ol><h3>High-level steps</h3><ol><li>Confirm permissions and access to Azure AI Services.</li><li>Create a managed API endpoint for the Language Service.</li><li>Test the API via the Python code samples.</li><li>Optionally, test the API hosted locally in Docker.</li><li>Clean up resources.</li></ol><h3>Step-by-step walkthrough</h3><h4>Step 1: Initial setup to confirm access to AI Services</h4><p>Open the Azure Portal at <a href="https://portal.azure.com/">https://portal.azure.com</a>, navigate to <strong><em>Microsoft Entra ID</em></strong> (formerly Azure Active Directory), search for your user account and select it, and then select <strong><em>Azure role assignment</em></strong>. The simplest option for this exercise is to assign either Owner or Contributor at the Subscription or Resource Group level, to ensure proper access to the Azure resources to be created. In my case, I created a Resource Group and gave my user the Owner role on the Resource Group.</p><p>Azure role assignments are explained <a href="https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal">here</a> and if you do not have a Resource Group yet, a full explanation of its usage is explained <a href="https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-portal">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9eRkRtHnnL2IN-vUTsVWYw.png" /><figcaption>Azure role assignments for a specific user</figcaption></figure><p>In the Azure Portal, navigate to <strong><em>Subscriptions</em></strong> and select <strong><em>Resource Providers</em></strong>. Find <strong><em>Microsoft.CognitiveServices</em></strong> and select <strong><em>Register</em></strong> if this resource is not registered yet.</p><p>This process is explained <a href="https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types#azure-portal">here</a> in detail on the Azure Resource Manager documentation site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kJljQD_JccysDyxST3LtLA.png" /><figcaption>Resource Providers</figcaption></figure><h4>Step 2: Create a managed API endpoint for the Language Service</h4><p>Azure AI Services are managed services with an API exposed for easy consumption. There is an option called <a href="https://learn.microsoft.com/en-us/azure/ai-services/content-understanding/how-to/create-multi-service-resource">Azure AI service multi-service account</a>, which provides access to multiple AI services through one endpoint, but it requires <a href="https://learn.microsoft.com/en-us/azure/container-instances/">container deployment</a> to expose the API. So for this example, the managed <a href="https://learn.microsoft.com/en-us/azure/ai-services/language-service/">Language Service</a> is being used as it is a dedicated resource for language-specific features only, and it’s easier to set up.</p><p>In the Azure Portal, navigate to <strong><em>Azure AI Services</em></strong> and select <strong><em>Language Service</em></strong>, then select <strong><em>Create Language</em></strong>.</p><p>Azure AI service for Language comes with several pre-built capabilities like sentiment analysis, key phrase extraction, and others, which are sufficient for this exercise. Select <strong><em>Continue to create your resource</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*nCdr0b0PkCfuuGvP9KByqA.png" /><figcaption>Create Language Service Resource</figcaption></figure><p>Navigate through the wizard pages and set the following fields:</p><ul><li><strong>Subscription</strong>: Defaults to your current subscription.</li><li><strong>Resource Group</strong>: Use an existing group or create one for this exercise.</li><li><strong>Region</strong>: Defaults to East US.</li><li><strong>Name</strong>: Choose a unique name for your Language Service domain name.</li><li><strong>Pricing tier</strong>: Choose the free tier if shown.</li><li>Check the box regarding Responsible AI use.</li><li><strong>Network</strong>: Choose all networks, unless you want to take the time to restrict access to a specific network, IP range, or private endpoint. For this example, I chose public access for ease of use, but it is not recommended for long-term purposes.</li></ul><p>I did encounter some Azure Portal bugs where error messages did not coincide with reality, so if you encounter them be sure to confirm you followed step 1 above to confirm access to AI Services, before assuming it’s a false error message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*hVIAQgNFdZ-GqSpvDwZ-Ug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*QLTVH88OAfK2DCpUOgx7Bw.png" /></figure><p>On the last page of the wizard, review the settings and select <strong><em>Create</em></strong> to create the resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*K3pFnhAppLsLKhGC2iRs7Q.png" /><figcaption>Create Language Service confirmation screen</figcaption></figure><p>Deployment should take a few minutes, then select <strong><em>Go to resource</em></strong> to view its settings. Here you can explore more to understand the capabilities of the Language Service and its configuration. Select <strong><em>Keys and Endpoint</em></strong> to reveal the two pieces of information needed to access the API in step 3 below.</p><p>Note that two keys are available and this is for easy key rotation when needed, but either key will work for API access. Best practices for secrets management in Azure can be found <a href="https://learn.microsoft.com/en-us/azure/security/fundamentals/secrets-best-practices">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*L0dn5Oo0v-MIhjphX3pVAg.png" /><figcaption>Key and endpoint for the Language Service</figcaption></figure><h4>Step 3: Test the API via the Python code samples</h4><p>Assuming you have Python and pip installed locally, and have access to Github, as explained in the Prerequisites section above, you can use the sample code in this <a href="https://github.com/doitintl/azure-ai-services-demo">repository</a>, either by downloading a zip file or cloning the repository.</p><pre>git clone https://github.com/dspenard/azure-ai-services-demo.git</pre><p>Once the code is available locally on your machine, modify the .env file to specify your API key and endpoint from step 3 above. The text analytics version 3.1 was current at the writing of this article, so please refer to the <a href="https://learn.microsoft.com/en-us/rest/api/language/">Language REST API reference</a> if there are any issues with that version.</p><pre>COGNITIVE_SERVICES_ENDPOINT=&lt;your endpoint&gt;<br>COGNITIVE_SERVICES_KEY=&lt;your api key&gt;<br>SENTIMENT_ANALYSIS_PATH=/text/analytics/v3.1/sentiment?<br>KEY_PHRASE_EXTRACTION_PATH=/text/analytics/v3.1/keyPhrases<br>LANGUAGE_DETECTION_PATH=/text/analytics/v3.1/languages?</pre><p>There is one <a href="https://pypi.org/project/python-dotenv/">dependency</a> that needs to be installed before the code can be executed. If you encounter issues installing this library or executing any of the Python code, then a Python virtual environment can be used to run the samples from a clean slate. Virtual environments are explained <a href="https://www.geeksforgeeks.org/python-virtual-environment/">here</a> and only require a few steps to set up and use with Python.</p><pre>pip install python-dotenv</pre><p>There are three Python files available to test a few of the capabilities of the Language Service: <a href="https://learn.microsoft.com/en-us/azure/ai-services/language-service/sentiment-opinion-mining/overview?tabs=prebuilt">sentiment analysis</a>, <a href="https://learn.microsoft.com/en-us/azure/ai-services/language-service/key-phrase-extraction/overview">key phrase extraction</a>, and <a href="https://learn.microsoft.com/en-us/azure/ai-services/language-service/language-detection/overview">language detection</a>. Use just one of these commands to execute the specific Python file.</p><pre>python sentiment_analysis.py<br>python key_phrase_extraction.py<br>python language_detection.py</pre><p>At the command line, enter some text for analysis, as shown below for key phrase extraction.</p><pre>david@Mac azure-ai-services-demo % python key_phrase_extraction.py <br>Enter some text to extract its key phrases. Enter q to quit.<br><br>Language detection is one of the features offered by Azure AI Language, <br>a collection of machine learning and AI algorithms in the cloud for <br>developing intelligent applications that involve written language. <br>Language detection is able to detect more than 100 languages in their <br>primary script.<br><br>Request:<br> {<br>  &quot;documents&quot;: [<br>    {<br>      &quot;id&quot;: 1,<br>      &quot;text&quot;: &quot;Language detection is one of the features offered by <br>Azure AI Language, a collection of machine learning and AI algorithms <br>in the cloud for developing intelligent applications that involve written <br>language. Language detection is able to detect more than 100 languages <br>in their primary script.&quot;<br>    }<br>  ]<br>}<br><br>Response:<br> {<br>  &quot;documents&quot;: [<br>    {<br>      &quot;id&quot;: &quot;1&quot;,<br>      &quot;keyPhrases&quot;: [<br>        &quot;Azure AI Language&quot;,<br>        &quot;AI algorithms&quot;,<br>        &quot;Language detection&quot;,<br>        &quot;written language&quot;,<br>        &quot;machine learning&quot;,<br>        &quot;intelligent applications&quot;,<br>        &quot;primary script&quot;,<br>        &quot;features&quot;,<br>        &quot;collection&quot;,<br>        &quot;cloud&quot;,<br>        &quot;100 languages&quot;<br>      ],<br>      &quot;warnings&quot;: []<br>    }<br>  ],<br>  &quot;errors&quot;: [],<br>  &quot;modelVersion&quot;: &quot;2022-10-01&quot;<br>}<br><br>Key Phrases:<br>- Azure AI Language<br>- AI algorithms<br>- Language detection<br>- written language<br>- machine learning<br>- intelligent applications<br>- primary script<br>- features<br>- collection<br>- cloud<br>- 100 languages</pre><p>To test the API using a CURL command, here’s an example of sentiment analysis. Just replace <strong><em>my-endpoint</em></strong> and <strong><em>my-key</em></strong> in the command.</p><pre>curl -X POST &quot;https://<strong>my-endpoint</strong>/text/analytics/v3.1/sentiment&quot; \<br>-H &quot;Content-Type: application/json&quot; \<br>-H &quot;Ocp-Apim-Subscription-Key: <strong>my-key</strong>&quot; \<br>-d &quot;{\&quot;documents\&quot;:[{\&quot;id\&quot;:\&quot;1\&quot;,\&quot;text\&quot;:\&quot;The performance was amazing! The sound could have been clearer.\&quot;},{\&quot;id\&quot;:\&quot;2\&quot;,\&quot;text\&quot;:\&quot;The food and service were unacceptable. While the host was nice, the waiter was rude and food was cold.\&quot;}]}&quot;</pre><pre>{<br>    &quot;documents&quot;: [<br>        {<br>            &quot;id&quot;: &quot;1&quot;,<br>            &quot;sentiment&quot;: &quot;mixed&quot;,<br>            &quot;confidenceScores&quot;: {<br>                &quot;positive&quot;: 0.5,<br>                &quot;neutral&quot;: 0.09,<br>                &quot;negative&quot;: 0.41<br>            },<br>            &quot;sentences&quot;: [<br>                {<br>                    &quot;sentiment&quot;: &quot;positive&quot;,<br>                    &quot;confidenceScores&quot;: {<br>                        &quot;positive&quot;: 1.0,<br>                        &quot;neutral&quot;: 0.0,<br>                        &quot;negative&quot;: 0.0<br>                    },<br>                    &quot;offset&quot;: 0,<br>                    &quot;length&quot;: 29,<br>                    &quot;text&quot;: &quot;The performance was amazing! &quot;<br>                },<br>                {<br>                    &quot;sentiment&quot;: &quot;negative&quot;,<br>                    &quot;confidenceScores&quot;: {<br>                        &quot;positive&quot;: 0.0,<br>                        &quot;neutral&quot;: 0.17,<br>                        &quot;negative&quot;: 0.82<br>                    },<br>                    &quot;offset&quot;: 29,<br>                    &quot;length&quot;: 34,<br>                    &quot;text&quot;: &quot;The sound could have been clearer.&quot;<br>                }<br>            ],<br>            &quot;warnings&quot;: []<br>        },<br>        {<br>            &quot;id&quot;: &quot;2&quot;,<br>            &quot;sentiment&quot;: &quot;negative&quot;,<br>            &quot;confidenceScores&quot;: {<br>                &quot;positive&quot;: 0.0,<br>                &quot;neutral&quot;: 0.0,<br>                &quot;negative&quot;: 1.0<br>            },<br>            &quot;sentences&quot;: [<br>                {<br>                    &quot;sentiment&quot;: &quot;negative&quot;,<br>                    &quot;confidenceScores&quot;: {<br>                        &quot;positive&quot;: 0.0,<br>                        &quot;neutral&quot;: 0.0,<br>                        &quot;negative&quot;: 1.0<br>                    },<br>                    &quot;offset&quot;: 0,<br>                    &quot;length&quot;: 40,<br>                    &quot;text&quot;: &quot;The food and service were unacceptable. &quot;<br>                },<br>                {<br>                    &quot;sentiment&quot;: &quot;negative&quot;,<br>                    &quot;confidenceScores&quot;: {<br>                        &quot;positive&quot;: 0.0,<br>                        &quot;neutral&quot;: 0.0,<br>                        &quot;negative&quot;: 1.0<br>                    },<br>                    &quot;offset&quot;: 40,<br>                    &quot;length&quot;: 63,<br>                    &quot;text&quot;: &quot;While the host was nice, the waiter was rude and food was cold.&quot;<br>                }<br>            ],<br>            &quot;warnings&quot;: []<br>        }<br>    ],<br>    &quot;errors&quot;: [],<br>    &quot;modelVersion&quot;: &quot;2024-03-01&quot;<br>}  </pre><h4>Step 4: Host the API in Docker</h4><p>As an optional exercise, if you are familiar with Docker and want to host the Language Service API in a Docker container, it is easy to set up. In this scenario, there are images available for specific features of Language Service, such as <a href="https://mcr.microsoft.com/en-us/artifact/mar/azure-cognitive-services/textanalytics/sentiment/about">sentiment analysis</a>.</p><p>Deploy the Docker container locally. Just replace <strong><em>my-endpoint</em></strong> and <strong><em>my-key</em></strong> in the command. Details on configuring and running the sentiment analysis container can be found <a href="https://learn.microsoft.com/en-us/azure/ai-services/language-service/sentiment-opinion-mining/how-to/use-containers">here</a>.</p><pre>docker run --rm -it -p 5000:5000 --memory 4g --cpus 1 mcr.microsoft.com/azure-cognitive-services/textanalytics/sentiment:latest Eula=accept Billing=https://<strong>my-endpoint</strong> ApiKey=<strong>my-key</strong></pre><p>If you encounter issues with port 5000, then choose a different <a href="https://www.stationx.net/common-ports-cheat-sheet/">port</a>. In the case of Mac OS the AirPlay Receiver might be running at port 5000, which can be turned off at <a href="https://stackoverflow.com/questions/72369320/why-always-something-is-running-at-port-5000-on-my-mac">System Settings &gt; General &gt; AirDrop &amp; Handoff &gt; AirPlay Receiver</a>.</p><p>Once the image is pulled down and the container built, you can confirm it is running by browsing to <strong><em>http://localhost:5000/</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hrk-vsrhyjkDnN58CsBRGA.png" /><figcaption>Local Docker container running</figcaption></figure><p>There is also a status page at <strong><em>http://localhost:5000/status</em></strong> and a full set of endpoint documentation at <strong><em>http://localhost:5000/swagger</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*sMDBqoc7NZ8EwnqOdubAeA.png" /><figcaption>Local Docker container status page</figcaption></figure><p>Now test the container with a CURL command, similar to the command to test the managed service hosted in Azure AI Services, except the port is specified and the API key is not needed in the header.</p><pre> curl -X POST &quot;http://localhost:5000/text/analytics/v3.1/sentiment&quot; -H &quot;Content-Type: application/json&quot; --data-ascii &quot;{&#39;documents&#39;:[{&#39;id&#39;:1,&#39;text&#39;:&#39;The performance was amazing! The sound could have been clearer.&#39;},{&#39;id&#39;:2,&#39;text&#39;:&#39;The food and service were unacceptable. While the host was nice, the waiter was rude and food was cold.&#39;}]}&quot;</pre><pre>{<br>    &quot;documents&quot;: [<br>        {<br>            &quot;id&quot;: &quot;1&quot;,<br>            &quot;sentiment&quot;: &quot;positive&quot;,<br>            &quot;confidenceScores&quot;: {<br>                &quot;positive&quot;: 0.99,<br>                &quot;neutral&quot;: 0.0,<br>                &quot;negative&quot;: 0.0<br>            },<br>            &quot;sentences&quot;: [<br>                {<br>                    &quot;sentiment&quot;: &quot;positive&quot;,<br>                    &quot;confidenceScores&quot;: {<br>                        &quot;positive&quot;: 0.99,<br>                        &quot;neutral&quot;: 0.0,<br>                        &quot;negative&quot;: 0.0<br>                    },<br>                    &quot;offset&quot;: 0,<br>                    &quot;length&quot;: 29,<br>                    &quot;text&quot;: &quot;The performance was amazing! &quot;<br>                },<br>                {<br>                    &quot;sentiment&quot;: &quot;neutral&quot;,<br>                    &quot;confidenceScores&quot;: {<br>                        &quot;positive&quot;: 0.19,<br>                        &quot;neutral&quot;: 0.47,<br>                        &quot;negative&quot;: 0.34<br>                    },<br>                    &quot;offset&quot;: 29,<br>                    &quot;length&quot;: 34,<br>                    &quot;text&quot;: &quot;The sound could have been clearer.&quot;<br>                }<br>            ],<br>            &quot;warnings&quot;: []<br>        },<br>        {<br>            &quot;id&quot;: &quot;2&quot;,<br>            &quot;sentiment&quot;: &quot;negative&quot;,<br>            &quot;confidenceScores&quot;: {<br>                            &quot;positive&quot;: 0.0,<br>                &quot;neutral&quot;: 0.01,<br>                &quot;negative&quot;: 0.98<br>            },<br>            &quot;sentences&quot;: [<br>                {<br>                    &quot;sentiment&quot;: &quot;negative&quot;,<br>                    &quot;confidenceScores&quot;: {<br>                        &quot;positive&quot;: 0.0,<br>                        &quot;neutral&quot;: 0.01,<br>                        &quot;negative&quot;: 0.99<br>                    },<br>                    &quot;offset&quot;: 0,<br>                    &quot;length&quot;: 40,<br>                    &quot;text&quot;: &quot;The food and service were unacceptable. &quot;<br>                },<br>                {<br>                    &quot;sentiment&quot;: &quot;negative&quot;,<br>                    &quot;confidenceScores&quot;: {<br>                        &quot;positive&quot;: 0.0,<br>                        &quot;neutral&quot;: 0.02,<br>                        &quot;negative&quot;: 0.98<br>                    },<br>                    &quot;offset&quot;: 40,<br>                    &quot;length&quot;: 63,<br>                    &quot;text&quot;: &quot;While the host was nice, the waiter was rude and food was cold.&quot;<br>                }<br>            ],<br>            &quot;warnings&quot;: []<br>        }<br>    ],<br>    &quot;errors&quot;: [],<br>    &quot;modelVersion&quot;: &quot;2022-11-01&quot;<br>}</pre><p><strong>Deploying container to Azure</strong></p><p>This is outside the scope and primary focus of this article, but as Docker hosting was demonstrated, it is worth mentioning that Azure has numerous options for building and deploying cloud-native and containerized applications. Depending on specific needs for scaling, cost, high availability, management preferences to not use the managed service for Azure AI, and other concerns, some options to consider are <strong>Azure Container Instances, Azure Container Apps, </strong>or<strong> Azure Kubernetes Service</strong>. These options and others are explained in more detail <a href="https://learn.microsoft.com/en-us/azure/container-apps/compare-options">here</a>.</p><h4>Step 5: Cleanup Azure resources</h4><p>Cleanup of the Azure resources used in this exercise is easy, as only the Language Service was created. If you created a Resource Group just for this exercise you can delete that as well, if you prefer, but it has no cost as it’s simply a way to group Azure resources.</p><p>Navigate to <strong><em>Azure AI Services</em></strong>, select <strong><em>Language Service</em></strong>, then check the box for the service you created, then select <strong><em>Delete</em></strong><em> </em>and proceed with the deletion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6dGgifvfvHReNGPm_k-HQ.png" /><figcaption>Language Service deletion</figcaption></figure><h3>Summary</h3><p><strong>Azure AI Language Service</strong> empowers businesses to extract meaningful insights from text using <strong>sentiment analysis, key phrase extraction, </strong>and<strong> language detection</strong>. We demonstrated how easy it is to integrate these capabilities into applications with a managed AI Azure Services endpoint, or through self-hosting a container running in Docker or anywhere a containerized application can be deployed.</p><h4><strong>Key Takeaways</strong></h4><p><strong>Why Choose Azure AI Language Service?</strong></p><ul><li><strong>Ease of Use</strong>: With pre-built models and simple APIs, businesses can quickly integrate advanced Natural Language Processing capabilities into their applications without needing deep expertise in machine learning.</li><li><strong>Seamless Integration</strong>: Azure AI Language Service integrates seamlessly with other Azure tools, such as <strong>Azure Machine Learning</strong>, <strong>Power BI</strong>, and <strong>Azure Synapse Analytics</strong>, enabling end-to-end data analysis and visualization.</li><li><strong>Cost-Effectiveness</strong>: Pay-as-you-go pricing and scalable infrastructure ensure that businesses only pay for what they use, making it accessible for organizations of all sizes.</li><li><strong>Flexibility and Scalability</strong>: Whether you&#39;re using managed endpoints for quick integration or running services in containers for greater control, Azure AI Language Service offers the flexibility to meet diverse business needs. The scalability of these services ensures that they can handle workloads of any size, from small startups to large enterprises.</li><li><strong>Enterprise-Grade Security</strong>: Azure’s robust security and compliance features ensure that your data is protected at every step.</li></ul><h4><strong>Example Use Cases</strong></h4><ul><li><strong>Sentiment Analysis: </strong>By understanding the sentiment behind customer feedback, reviews, or social media posts, businesses can identify areas for improvement, measure customer satisfaction, and tailor their strategies to enhance customer experiences.</li><li><strong>Key Phrase Extraction: </strong>Extracting key phrases from documents, emails, or support tickets helps businesses quickly identify the main topics, trends, and pain points. This enables faster response times, better resource allocation, and more informed decision-making.</li><li><strong>Language Detection: </strong>Automatically detecting the language of text allows businesses to streamline multilingual workflows, improve communication with global audiences, and ensure that content is appropriately localized.</li></ul><h4>Get Started</h4><p>From cost optimization to infrastructure automation, and security hardening to cloud architecture design, DoiT International offers extensive expertise across multiple cloud domains. To explore how DoiT can help you implement AI and modernize other aspects of your cloud infrastructure, please contact us <a href="https://www.doit.com/contact/?utm_source=test&amp;utm_medium=topnavcontact&amp;utm_id=top_nav_contact_link">here</a> to learn about our cloud engineering solutions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45c0d7b4a3ea" width="1" height="1" alt=""><hr><p><a href="https://medium.com/doit-international/azure-ai-natural-language-understanding-from-text-to-actionable-insights-45c0d7b4a3ea">Azure AI Natural Language Understanding: From Text to Actionable Insights</a> was originally published in <a href="https://medium.com/doit-international">DoiT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ease Your Jenkins Master Node Pains With Remote Agents]]></title>
            <link>https://dspenard.medium.com/ease-your-jenkins-master-node-pains-with-remote-agents-9fc6c2e336ee?source=rss-39209af5a795------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fc6c2e336ee</guid>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[David Spenard]]></dc:creator>
            <pubDate>Sat, 28 Aug 2021 01:03:22 GMT</pubDate>
            <atom:updated>2021-08-29T22:14:32.517Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RXh0nHJm_NXWW9KidWOsNA.jpeg" /></figure><p>Jenkins is great because you can automate anything with it; Jenkins is terrible because you can automate anything with it. Anyone who has spent even a short amount of time wrangling Jenkins will understand that paradox. Configuring Jenkins can be tedious and error prone, and it’s easy to slip into the depths of plug-in hell, as there is a plug-in for everything. And then once you get it configured correctly, it will meet your needs, at least for a little while. Eventually jobs will begin to fail, plug-ins will stop working, those undocumented configuration changes will bite you, <a href="https://groovy-lang.org/">Groovy</a> idiosyncrasies<strong> </strong>inside Jenkinsfiles will annoy you, and the weight of this outdated monolith will keep you up at night thinking about the duct tape holding it all together.</p><p>But I’m not here to harp about why Jenkins can be painful, as there are plenty of online resources supporting the pros and cons of Jenkins. I can think of a few CI/CD tools I prefer over Jenkins, but it’s not going away any time soon and it’s quite common to come across organizations running numerous bloated Jenkins instances overloaded with excessive, long-running, concurrent jobs. Scaling up can go past the point of ridiculousness, but other measures should be taken to prevent a total crash and burn. <a href="https://jenkins-x.io/v3/about/what/">JenkinsX</a> offers a cloud-native solution, but it’s not as easy as simply extending Jenkins pipelines into Jenkin X, and migrating everything to an alternative like <a href="https://about.gitlab.com/">GitLab </a>or <a href="https://azure.microsoft.com/en-us/services/devops/pipelines/">Azure DevOps</a> might be unfeasible for the organization at the moment. So this is where using <a href="https://www.jenkins.io/doc/book/using/using-agents/">Jenkins Agents</a> (also called Jenkins Slaves) come into the picture, to alleviate the pains of a bloated Jenkins Master node, with minimal effort.</p><p>There are two notable ways to use Jenkins Agents, which I will explain in detail in the tutorial below:</p><ol><li><a href="https://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/jnlp.html">Java Network Launch Protocol (JNLP)</a> connection</li><li><a href="https://www.ssh.com/academy/ssh/protocol">SSH </a>connection</li></ol><p>SSH is the preferred method for using Jenkins Agents. With JNLP, a .jar file executes on the Agent node and talks back to the Master node. If the Java app stops running or the Master node restarts, or something else occurs to break the connection, then the Agent will not be accessible from the Master. SSH is much cleaner and reliable.</p><p>I’m using Jenkins running in AWS, so this procedure is geared towards AWS, but you can apply the same basic steps for any other cloud provider. I’m assuming you have some basic AWS EC2 and networking knowledge, know how to use the Linux command line and SSH, and have used Jenkins in the past. So let’s get to it.</p><h3>JNLP Connection</h3><h4>Step 1 — Set up Jenkins Master instance</h4><p>Details for setting up Jenkins on an AWS EC2 can be found <a href="https://d1.awsstatic.com/Projects/P5505030/aws-project_Jenkins-build-server.pdf">here</a>. Unless you already have a Jenkins server set up, you will need to follow the instructions to install and unlock Jenkins for its initial use.</p><p>Spin up an AWS instance for the Jenkins Master. For both the Master and Agent nodes I used the AWS public image <em>debian-stretch-hvm-x86_64-gp2–2018–11–10–63975</em></p><p>In my case the Master and Agent instances are running in a private subnet with a security group allowing SSH access to the instances and web access to load the Jenkins Master node UI in the browser. You can configure the instances and their networking how you see fit, but you will at least need a security group providing the required access to launch the Jenkins UI and to SSH into the Agent instance.</p><h4>Step 2 — Set up Jenkins Agent instance</h4><p>Spin up another AWS instance for the Jenkins Agent. Obviously the more Agent nodes the better, but we’re only setting up one here for simplicity.</p><p>SSH into the Agent instance and install the Java JDK. These instructions should work fine. <a href="https://docs.datastax.com/en/jdk-install/doc/jdk-install/installOpenJdkDeb.html">https://docs.datastax.com/en/jdk-install/doc/jdk-install/installOpenJdkDeb.html</a></p><p>Create a folder for the Jenkins workspace on the Agent. I provided full access to that folder but it could be tweaked down appropriately.</p><pre>$ sudo mkdir /var/lib/jenkins<br>$ sudo chmod 777 /var/lib/jenkins</pre><h4>Step 3 — Configure Agent Node in Jenkins</h4><p>Proceed to the URL for the Jenkins Master to load the UI in the browser.</p><p>Under <strong>Manage Jenkins, </strong>choose <strong>Configure Global Security</strong> to set the TCP port for inbound agents to random.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*duFIzqvEsDMomp82ZBVwBg.png" /></figure><p>Under <strong>Manage Jenkins</strong>, choose <strong>Manage Nodes and Clouds</strong> to configure the Agent Node connection. The remote root directory must match the directory created in step 2 above and the launch method ‘Launch agent by connecting it to the master’ is for using JNLP to connect to the Agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*DCKw6A9IuKrnYD92m-CwEA.png" /></figure><p>After saving the Agent configuration, you will be given a set of instructions for connecting the Agent to the master. Click on the <strong>agent.jar</strong> link to download the file locally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wg07whcFxehOaoS4ii85IA.png" /></figure><p>Copy the agent.jar file to the Agent instance using scp or whatever means at your disposal.</p><pre>$ scp agent.jar david@10.10.12.259:/home/david</pre><h4><strong>Step 4 — Execute agent.jar on Agent instance</strong></h4><p>Copy the command provided to you after saving the Agent configuration in Jenkins, and execute it on the Agent instance.</p><pre>$ sudo java -jar agent.jar -jnlpUrl <a href="http://&lt;host/">http://&lt;host</a>-name-for-your- jenkins-master-node&gt;/computer/&lt;host-name-for-your-jenkins-agent-node&gt;/slave-agent.jnlp -secret 3da59d99210f736b9b2e1b7dee7e9ad266d67a453d567eae5e4094dab2a8f26d -workDir &quot;/var/lib/jenkins&quot;</pre><p>If successful, you will see the Agent connected to the Master.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*Jfc9KxS2TBDIUjMLEBo75g.png" /></figure><h4><strong>Step 5 — Run a Job in Jenkins to test the Agent node</strong></h4><p>Back in the Jenkins UI, create a simple job to use the Agent node. In my case I tested with a simple freestyle project executing some small bash script. Just check the box to restrict where the project can run, which in this case was <strong>agent-1 </strong>to match the label for the Agent Node configuration, and then run the job.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*KakVjwvkdCGfkPRlbdmweg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*frqyuK0HXZC4VmtQIT_AMw.png" /></figure><h3>SSH Connection (the better way)</h3><h4><strong>Step 1 — Set up Jenkins Master instance</strong></h4><p>If not already set up, follow the same steps as step 1 for using JNLP.</p><h4><strong>Step 2 — Set up Jenkins Agent instance</strong></h4><p>If not already set up, follow the same steps as step 2 for using JNLP.</p><p>After setting up the Agent instance and creating the /var/lib/jenkins folder, create a Jenkins user on the Agent instance.</p><pre>$ useradd -m -d /home/jenkins jenkins</pre><p>Then create a key pair for this user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*RNLlIYfgpNzD-Ou_FQ4vAA.png" /></figure><p>And then cat the private key file and copy the entire contents to the clipboard to use later in the Jenkins UI.</p><pre>$ cat ~/.ssh/id_rsa</pre><h4><strong>Step 3 — Create credentials in Jenkins</strong></h4><p>Proceed to the URL for the Jenkins Master to load the UI in the browser.</p><p>Under <strong>Manage Jenkins</strong>, choose <strong>Manage Credentials</strong> and then select the credentials store link for <strong>global </strong>and then choose <strong>Add Credentials</strong>. Create credentials for ‘SSH Username with private key’ and paste in the private key contents copied from step 2 above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*1vnj0tlVmz8C4CVLGwstAg.png" /></figure><h4>Step 4 — Configure Agent Node in Jenkins</h4><p>Under <strong>Manage Jenkins, </strong>if not already done<strong> </strong>choose <strong>Configure Global Security</strong> to set the TCP port for inbound agents to random.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*duFIzqvEsDMomp82ZBVwBg.png" /></figure><p>Under <strong>Manage Jenkins</strong>, choose <strong>Manage Nodes and Clouds</strong> to configure the Agent Node connection. If you followed along and set up the Agent Node to use JLNP, then be sure to label this Agent Node configuration something different, as Jenkins will allow you to create duplicate labels. The remote root directory must match the directory created on the Agent instance and the launch method should be ‘Launch agents via SSH’. Provide the IP or host name for the Agent instance and select the credential created in Step 3 above. For Host Key Verification Strategy, it’s easier to choose ‘Manually trusted key Verification Strategy’, and then check the box for ‘Require manual verification of initial connection’. <strong><em>Non-verifying Verification Strategy should not be used</em></strong>, as that leaves you vulnerable to a man-in-the-middle attack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*90xclNxAsqnCEsvPtTXUhg.png" /></figure><h4>Step 5— Relaunch the Agent in Jenkins</h4><p>After saving the Agent configuration, relaunch it and select <strong>Trust SSH Host Key.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gl7jK_W6oRlfnLZz5SaWKw.png" /></figure><p>Relaunch the Agent again and you will notice an authentication error. This is expected because the server is rejecting the private key specified in the credentials you set up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ieJ_Pg3bmw9p4Sacsk5mcg.png" /></figure><h4>Step 6— Add public key to the authorized_keys on Agent instance</h4><p>Back in the Agent instance, the public key for the jenkins user created in step 2 above needs to be added to the list of authorized_keys. This will allow the Master node to talk to the Agent node over SSH using the credentials set up in Jenkins.</p><pre>$ su jenkins<br>$ cat id_rsa.pub &gt; authorized_keys</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hxf-_cyZX7mmeidcvfRATw.png" /></figure><h4>Step 7— Relauch the Agent again in Jenkins</h4><p>Just like in Step 5 above, relaunch the agent, but this time you should see a successful connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*Ug0cgfAnf-MNlaQZg7fIqw.png" /></figure><h4>Step 8— Run a Job in Jenkins to test the Agent node</h4><p>Create a simple job to use the Agent node. In my case I tested with a simple pipeline script and specified the agent label to use the Agent set up in step 4 above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wVeIPXM92686CmJlFoCmnA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*l7isiz-kgwbxRcrjALE_7w.png" /></figure><h3>Conclusion</h3><p>Adding Jenkins Agents can provide some relief when a Jenkins Master node is just plain overwhelmed, unreliable, and too fragile. My suggestion is by no means a silver bullet, and there are numerous things that can be done to improve upon what I presented, but I hope you found this article useful and find some sanity when using Jenkins. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fc6c2e336ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Push AWS S3 files to Google Drive]]></title>
            <link>https://medium.com/analytics-vidhya/push-aws-s3-files-to-google-drive-dabf5005a278?source=rss-39209af5a795------2</link>
            <guid isPermaLink="false">https://medium.com/p/dabf5005a278</guid>
            <category><![CDATA[google-drive-api]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[google-drive]]></category>
            <dc:creator><![CDATA[David Spenard]]></dc:creator>
            <pubDate>Fri, 19 Feb 2021 18:32:33 GMT</pubDate>
            <atom:updated>2021-05-24T02:45:36.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0N07MLVct_TDE_OGjRSQKw.png" /></figure><p>In this tutorial I will demonstrate how to integrate AWS with Google Drive. My client requested that Excel files containing AWS cost and usage report data and charts be pushed to Google Drive on a weekly schedule, and I hope to provide some insight on how I went about solving the problem. I’ll have a follow-up post demonstrating how to use Python with <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/index.html">Boto3</a> and <a href="https://pandas.pydata.org/">pandas</a> to produce Excel files with AWS cost and usage data, but for now the focus is integrating AWS with Google Drive.</p><p>When I was given this assignment I figured it should be simple enough to find a decent example online for how to use the Google Drive API. I quickly discovered conflicting information and half-baked code snippets, and some of the confusion came from actual Google documentation. So I went directly to the source for the <a href="https://developers.google.com/drive/api/v3/reference/files/create">Google Drive API</a> to see how to push a file, and then worked backwards from there to settle on a language for the AWS Lambda function to be created. My personal language choices are Node, Python, Go, or C#, and I eventually settled on Python for its simplicity and availability of information online. When I was nearly done this assignment I did stumble upon <a href="https://pypi.org/project/PyDrive/">PyDrive</a> as a viable solution to the problem, but I ended up using the <a href="https://github.com/googleapis/google-api-python-client">Google API Python Client</a>.</p><p>I created a demo solution <a href="https://github.com/dspenard/google-drive-with-aws">google-drive-with-aws</a> in Github, which I will walk through in a series of steps to highlight important pieces. The solution in Github is not fully-automated, but it’s like 95% there with a few manual modifications required to run the necessary scripts. So let’s get started.</p><h3>What’s Required?</h3><p>From the interaction diagram shown above you can see a few things for both AWS and Google. The basic steps are:</p><ol><li>Create a GCP Service Account</li><li>Create a Google Drive Shared Folder and give access to the service account</li><li>Deploy a CloudFormation stack to create an S3 bucket and Parameter Store parameters</li><li>Manually update Parameter Store with the Google service account credentials and the Google Drive Shared Folder ID</li><li>Set up test files in S3</li><li>Package the Lambda code and layer</li><li>Deploy a CloudFormation stack to create the Lambda resources</li><li>Manually test the Lambda function</li><li>Clean up the resources</li></ol><p><strong>Step 1 — GCP Service Account</strong></p><p>I’m not going into the details of using GCP beyond what is required for this tutorial, but if you do not already have a GCP account, you can create one free <a href="https://cloud.google.com/free">here</a>.</p><p>Once you have your GCP account the first item of business is the creation of a Project. A Project in GCP creates a boundary where GCP workloads can be isolated from one another, very much in the same way an AWS account or Azure subscription operates.</p><p>You can choose any name you like, but I chose google-drive-access to distinguish it from other projects I already had in my GCP account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*_roHOR2t3NZ2wlmyUXrF1w.png" /></figure><p>After the project is ready a GCP service account needs to be created. The service account is what allows you to programmatically utilize GCP resources as permitted by the permissions on the service account. For our purposes this service account will only be interacting with Google Drive, and not any Compute, Networking, or Storage resources in GCP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*l8GSdxcR6bIrsZtNvONcsQ.png" /></figure><p>After the service account is created, a key needs to be created and downloaded, which contains the credentials information in the form of JSON.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*iFaAEZq1INLalmYgQLsdQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*IbBu9mguIm20yAAN7NXg6Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*Y988jngnPCdaZD4t_4SKDg.png" /></figure><p>You will need the credentials file later on to let AWS Lambda access Google Drive.</p><p><strong>Step 2 — Google Drive</strong></p><p>Now that the GCP Service Account is created, you need to do two things: Enable the Google Drive API and allow the service account to access Google Drive.</p><p>First up is the Google Drive API. Back in the Google Console you can search for ‘Google Drive API’ to find the page where you enable it. Conveniently if you forget this step, when you run the Lambda function later on you will get a nice, clean error message with an actual link to where you can enable it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*nYsz6-L-S46WgAfhb8S6tA.png" /></figure><p>Next up is giving the service account permission to access Google Drive. Go to Google Drive and create a folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*SywdCy2ekwmP7-MeuVLAEg.png" /></figure><p>Then click on that folder and choose Share.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*hyxnTQK7lsHq4FvFvl8WUA.png" /></figure><p>Then give the service account permission to write to this folder. You will use the email address associated with the service account, which is available under the Details page for the service account back in Google Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*70hJ6x27lrgUFljmEW5ouA.png" /></figure><p><strong>Step 3 — AWS CloudFormation</strong></p><p>I’m assuming that you found this tutorial because you’re working with AWS and need to push files to Google Drive, but if you’re not already in-flight with AWS you can create a free account <a href="https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&amp;all-free-tier.sort-order=asc">here</a>.</p><p>When I created this solution for my client, the end result was a bit different from what I have laid out in my <a href="https://github.com/dspenard/google-drive-with-aws">Github solution</a>, which is entirely intended to demonstrate the key points of this tutorial. What I decided for the tutorial was a series of steps to quickly get the solution up and running with minimal pain, so hopefully I will accomplish just that.</p><p>To get things going, I would recommend using <a href="https://aws.amazon.com/cloudshell/">AWS CloudShell</a>. It provides a shell with 1 GB of persistent storage and numerous pre-installed libraries for AWS CLI, PowerShell, Bash, Python, and more. The only requirement is that the AWS account you will be using to run the scripts in this tutorial has the proper permissions to access the shell and the resources associated with this tutorial. For my own purposes I quickly created a group with the attached policies shown below, and then assigned that group to my user. It is definitely giving too much permission, so I don’t recommend leaving your account in this state after you get this solution running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*8JmtczsKvUn3eg2hWwWHnQ.png" /></figure><p>Now that your AWS account has the necessary permissions, start CloudShell and get to work. The first thing you’ll want to do is clone my repo.</p><pre>git clone <a href="https://github.com/dspenard/google-drive-with-aws.git">https://github.com/dspenard/google-drive-with-aws.git</a></pre><p>Then change to the scripts folder.</p><pre>cd google-drive-with-aws/scripts</pre><p>Then run the bash script build-bucket-and-ssm-resources.sh. But before doing so you have to modify the script to choose a bucket name. This bucket will be used to hold both the files to be pushed to Google Drive and the Lambda code and Layer files. For simplicity sake I chose to just have one bucket, but in a real production system you would normally have Lambda code and Layer zip files in a dedicated S3 bucket or some other artifact repository.</p><pre>aws cloudformation create-stack \    <br>  --stack-name google-drive-bucket-and-ssm \    <br>  --template-body file://bucket-and-ssm-resources.yaml \    <br>  --capabilities CAPABILITY_AUTO_EXPAND \    <br>  --parameters        ParameterKey=LambdaAndReportBucket,ParameterValue=<strong>your-bucket-name</strong> \              ParameterKey=GoogleServiceAccountCredentials,ParameterValue=google-service-account-credentials \        ParameterKey=GoogleDriveFolderId,ParameterValue=google-drive-folder-id</pre><p>Once you have a bucket name chosen and run the script, go into the AWS Console to check its status.</p><p><strong>Step 4 — AWS Parameter Store</strong></p><p>Once the CloudFormation stack is created, a couple manual updates to Parameter Store are needed. The credentials JSON for the Google Service Account and the ID for the Google Drive Shared Folder need to be dropped into these respective parameters. Note that the data types are String and not SecureString due to a limitation of CloudFormation, but this is just a tutorial, so please do not use cleartext strings for any secret information in a real production system. For the Google Drive Shared Folder ID, you can find that by simply clicking on the link for your folder in Google Drive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n92TY9gEZHHUm0pnf750hg.png" /></figure><p><strong>Step 5 — S3 test files</strong></p><p>Because I was working with Excel files when I created this solution for my client, I chose to keep the same for this tutorial. There are a few dummy Excel files that can be copied to S3 with a script. Again, you have to specify the S3 bucket name in the script. Yes, I could have fully scripted all of this out, but the focus of this tutorial is Google Drive with S3 and Lambda, deployed with CloudFormation, and not Bash scripting or proper deployment pipelines.</p><pre>bash copy-test-files.sh</pre><p><strong>Step 6 — Lambda</strong></p><p>I’m not going to discuss in detail the functionality in the <a href="https://github.com/dspenard/google-drive-with-aws/blob/main/src/google-drive-lambda.py">Python script</a>, but the basics are:</p><ul><li>Get Google Service Account credentials and Google Drive ID from Parameter Store</li><li>Connect to the Google Drive using the credentials and drive ID</li><li>Using Boto3, grab the specified files from S3, then push them to Google Drive using the <a href="https://developers.google.com/drive/api/v3/reference/files/create">Google Drive API create command</a></li></ul><p>If you examine the code you will see it’s very easy to follow if you understand basic Python, and I even left some tidbits on things to improve. One such case is calling the <a href="https://developers.google.com/drive/api/v3/reference/files/update">Google Drive API update command</a> when a file already exists. You will notice that file names are not considered distinct in Google Drive, and if you call create numerous times for files with the same name, duplicates will occur. Also, some defensive coding techniques should be added to tighten things up.</p><p>To get the Lambda code and its Layer zipped up and ready for deployment, run the script build-packages.sh. And again, modify the bucket name before doing so, to match the bucket you created with the first CloudFormation template. I chose to include the entire google-api-python-client library for the Lambda layer, which is a bit beefy at over 4 MB, so feel free to only include the absolute minimum for your Layer if doing this in a production system.</p><pre>bash build-packages.sh</pre><p><strong>Step 7 — More AWS CloudFormation</strong></p><p>At this point the S3 bucket has been set up with dummy test files and the Lambda code zip file and Layer zip file, and Parameter Store has what the Lambda needs to connect to Google Drive. Now it’s time to deploy the Lambda function with a child stack of the parent stack already set up. For this script, build-lambda-resources.sh, you only have to modify the specified stack name if you didn’t leave the default name I specified in the script to deploy the first stack in Step 3.</p><pre>aws cloudformation create-stack \    <br>  --stack-name google-drive-lambda \    <br>  --template-body file://lambda-resources.yaml \    <br>  --capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM \    <br>  --parameters ParameterKey=ParentStackName,ParameterValue=<strong>google-drive-bucket-and-ssm</strong></pre><p>Once you confirm the parent stack name is correct and run the script to deploy the stack, go into the AWS Console to check its status.</p><p><strong>Step 8 — Test the Lambda</strong></p><p>Now onto the best part, to see if this thing actually works. Go to the AWS Console to the Lambda function google-drive-lambda, and create a test event with the proper payload. Call it whatever you want, then click Test and you should be good to go. Note that for this tutorial I chose to have a payload specify a list of files to pull from S3 and push to Google Drive, but in a real production system you could trigger the Lambda from an S3 Event Trigger or choose some other path.</p><pre>{    <br>  &quot;fileList&quot;: [      <br>    &quot;Report1.xlsx&quot;,      <br>    &quot;Report2.xlsx&quot;,      <br>    &quot;Report3.xlsx&quot;    <br>  ]<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*CD9BKtgmJ405I31SAzKGJQ.png" /></figure><p>Voila, you just pushed files from S3 to Google Drive!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*p2hhYY7d0vS_JOXuLAE2cg.png" /></figure><p><strong>Step 9 — Cleanup</strong></p><p>I didn’t script out the AWS resources cleanup process, but it’s very simple. In the AWS Console, manually delete files from the S3 bucket, then go into CloudFormation and delete the two stacks, starting with the child stack, google-drive-lambda, and then onto the parent stack, google-drive-bucket-and-ssm. That should do it. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dabf5005a278" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/push-aws-s3-files-to-google-drive-dabf5005a278">Push AWS S3 files to Google Drive</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>