<?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 Sam Hardern on Medium]]></title>
        <description><![CDATA[Stories by Sam Hardern on Medium]]></description>
        <link>https://medium.com/@shardern?source=rss-5c7f4e52f62a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-QVO4c2GmdkQPvlkgghiOQ.jpeg</url>
            <title>Stories by Sam Hardern on Medium</title>
            <link>https://medium.com/@shardern?source=rss-5c7f4e52f62a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:32:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shardern/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[How KPMG UK Leverage Jira Data Connections]]></title>
            <link>https://medium.com/kpmg-uk-engineering/how-kpmg-uk-leverage-jira-data-connections-35ed1092115b?source=rss-5c7f4e52f62a------2</link>
            <guid isPermaLink="false">https://medium.com/p/35ed1092115b</guid>
            <category><![CDATA[atlassian]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[jira]]></category>
            <dc:creator><![CDATA[Sam Hardern]]></dc:creator>
            <pubDate>Wed, 25 Oct 2023 15:47:15 GMT</pubDate>
            <atom:updated>2023-10-25T15:47:15.764Z</atom:updated>
            <content:encoded><![CDATA[<p>Table of Contents</p><ul><li><a href="#3610">What are Data Connections?</a></li><li><a href="#a926">Why we need Proxy Lambdas</a></li><li><a href="#84e6">What if the Data Connection Times Out?</a></li><li><a href="#7bab">The Good and the Bad</a></li><li><a href="#1fc1">Next Steps in our Work</a></li><li><a href="#3b78">Conclusion</a></li></ul><p>Within Engineering at KPMG UK, we leverage Jira Service Management (JSM) to automate most user access requests. Examples include automated:</p><ol><li>Creation of new Services (Jira projects, Confluence spaces, Github repositories),</li><li>Provisioning of new users on various platforms, Jira, Azure Active Directory,</li><li>Group management tooling, allowing Jira users to manage their group memberships.</li></ol><p>We can go into plenty of detail about these automations and we have already <a href="https://www.youtube.com/watch?v=nuc5CoFM8b8">presented how they have benefited us</a>, but this blog is about another aspect of Jira Service Management that we have recently explored: Data Connections. Data Connections allow us to have JSM form fields populate with external data <strong>in real time</strong>.</p><p>Here are some quick-fire examples of where we’re leveraging Data Connections, we now have form fields that, in real time:</p><ul><li>Populate with data from Github, which we use for Source Code Management:<br>- A field for all Github repositories, so users can pick a specific repo in their form<br>- A field for all Github teams in the organisation, so users can pick the team to be added to</li><li>List all Jira Projects and all Confluence Spaces. There are no native fields for either of these, and our Data Connection fields can be used to select Projects to be deleted, or Spaces that a user requires access to.</li><li>List all groups in Atlassian or Azure Active Directory (our IDP). This allows users to request access to certain groups, or request a list of members from these groups. This is important as regular Jira users do not have visibility of group memberships without going to organisation admins.</li></ul><p><em>So, how did we set all this up?</em> Let’s dive in…!</p><h3>What are Data Connections?</h3><p>Data Connections are a useful tool implemented within Jira Service Management that allow the population of Form fields with live data gathered from API Calls. This applies to radio buttons, checkboxes and select dropdown fields.</p><p>When a form containing a data connection is accessed, behind the scenes an API request is made and the field’s data is refreshed. This is the case unless caching is configured, which allows admins to tell Data Connections to remember its results for a period of time. This reduces the number of api calls made by the Data Connection and can lead to a better user experience, since users will not need to wait for the data to be gathered as often.</p><p>Without Data Connections, the next best thing is to have custom fields with static data that administrators will need to regularly update; not ideal!</p><p>Data Connections are configured within the “Issues” section of the Jira Admin area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-cJiFJE-t_I46a66mQRMQ.png" /><figcaption>Image taken from <a href="https://confluence.atlassian.com/proforma/data-connections-1087521268.html">Atlassian’s documentation</a></figcaption></figure><h3>Why we need Proxy Lambdas</h3><p>Data Connections are great. Except they have a few pitfalls:</p><ul><li>They cannot handle paginated responses</li><li>They require a persistent method of authentication</li><li>They cannot access API endpoints in private services. In our case, some of the data we wanted to grab sits behind a private network. We don’t want to allowlist all of Jira’s IP addresses to get it working!</li></ul><p>These factors, even individually, badly limit the versatility and usefulness of Data Connections.</p><p><em>So what is a Jira Admin to do…?</em></p><p>The answer: ⭐ <strong>Proxy Lambdas!</strong> ⭐</p><p>For those unfamiliar, <a href="https://aws.amazon.com/lambda/">AWS Lambda</a> is a service offered by AWS which leverages serverless computing and allows you to automate the running of scripts in a variety of languages. For our use case, we are specifically utilising <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html">Proxy Lambdas</a>. This means that when a lambda is triggered by an API call (from the Data Connection) instead of the API gateway handling the response, it is passed straight through to the Lambda function. Once the Lambda runs and a response is generated, the API gateway passes it straight back to that initial incoming request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7Js2J9E85bY0EA4opCXQQ.jpeg" /><figcaption>Illustration of how proxy lambdas work in our setup</figcaption></figure><p><em>OK but how does this help?</em></p><p>By moving the processing of the API endpoints to a Lambda function (specifically running a Python script in our case), we can:</p><ul><li>Handle pagination ourselves through our Python script</li><li>Handle non-persistent api tokens by regenerating them through code</li><li>Handle private endpoints by allowing the IP of the lambda to the service we need. The lambda function sits outside of the private VPC, so it can talk to both Jira and the target service.</li></ul><p>So, the proxy lambda handles all the heavy lifting, grabbing the data from any source. The Data Connection simply triggers that lambda and receives data from its response.</p><h3>What if the Data Connection Times Out?</h3><p>Whilst proxy lambdas solve a whole host of issues, they do come with their own limitations. One that we have personally encountered is the 30 second time-out limit of Lambdas when associated with an API endpoint. This has only been a problem for one of our Data Connections so far, but we fully expect it to be a problem later on as we expand our repertoire.</p><p>This becomes an issue when the lambda needs to grab <strong><em>a lot </em></strong>of data. In our case, we have a data connection that grabs all internal repositories from Github. That’s over 5000 repositories! As expected, it takes longer than 30 seconds to grab that data and we see the lambda timing out.</p><p>Our solution is to introduce a ⭐ <strong>second lambda.</strong> ⭐</p><p>In this 2-lambda solution, we have a standalone lambda gather, parse and store the data in an S3 bucket. As this Lambda is not connected to an API Gateway, it does not face the same restriction with timing out. In simple terms, its sole job is fetching data in the form of a JSON file and storing it.</p><p>Our second lambda then accesses that file and sends the text of the JSON file back to the data connection. This is <em>much faster</em> than grabbing directly from Github. By running the first lambda on a regular CRON job, we can still ensure that the data is up to date, and by storing it as a JSON, the second lambda has no extra leg work to do outside of sending the requested data.</p><h3>The Good and the Bad</h3><p>Data Connections have proved invaluable for our JSM site so far. Being able to offer an ever changing list of resources to be selected in JSM forms has freed up the time of our JSM Agents, as they don’t have to maintain lists that were previously basic custom fields. Data Connections have also allowed us to introduce a wider variety of automated tasks.</p><p>Chief amongst these are our Group Management tools that devolve the permission of managing groups to regular users without giving them site-admin access. We have Data Connections for group names and users from our Atlassian directory that allows users to interact with newly made groups or added users very shortly after they are on the site.</p><p>Based on our experience, we have one main area of improvement we’d like to see: <strong>more authentication options when configuring the data connection</strong>.</p><p>The current offerings are “Basic”, “Digest” and “Custom”. Since we are utilising proxy lambdas, we have not been able to make any of those work directly with a private API Endpoint from AWS and hope that Atlassian expands the range of options for wider usage in the future.</p><p>Additionally, we would really like to see Data Connections become available for regular custom fields, rather than being restricted to JSM forms. This would give us even more versatility across a larger portion of our Atlassian suite.</p><h3>Next Steps in our Work</h3><p>We aim to expand our suite of Data Connections; primarily focusing on pulling data from Inventory.</p><p>For context, Inventory is a custom-built internal service which contains an ⭐ <em>inventory</em>⭐ of all our cloud accounts, SSLs and other important services. Inventory lives within a private VPC, but has an API that we would like to make available for JSM. As Inventory is a source of truth for so much internal data, it is a great source for Data Connections.</p><p>Some of our plans for future Data Connections includes:</p><ul><li>Pulling existing “Services” from Inventory, which would help us to enable a number of applications. Services in Inventory group together cloud (AWS, Azure, GCP) accounts/subscriptions that belong to a single project or “service”</li><li>Pulling business owners of accounts and Services from Inventory so we can have targeted approvals for the decommissioning of accounts</li></ul><h3>Conclusion</h3><p>To conclude — Jira’s Data Connection feature has become an integral part of much of our JSM estate and we only see our usage increasing over time, especially with the workarounds provided by proxy lambdas. Data Connections aren’t perfect, but with a little know-how, they can be a powerful addition to a JSM instance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35ed1092115b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kpmg-uk-engineering/how-kpmg-uk-leverage-jira-data-connections-35ed1092115b">How KPMG UK Leverage Jira Data Connections</a> was originally published in <a href="https://medium.com/kpmg-uk-engineering">KPMG UK Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serverless Restructuring — Sometimes more files is a good thing]]></title>
            <link>https://medium.com/kpmg-uk-engineering/serverless-restructuring-sometimes-more-files-is-a-good-thing-bca52600a26d?source=rss-5c7f4e52f62a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bca52600a26d</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Sam Hardern]]></dc:creator>
            <pubDate>Fri, 22 Sep 2023 10:02:12 GMT</pubDate>
            <atom:updated>2023-09-22T10:02:12.546Z</atom:updated>
            <content:encoded><![CDATA[<h3>Serverless Restructuring — Sometimes more files is a good thing</h3><h4>Serverless is a great way of managing large numbers of functions in AWS, however there can be a point where it begins to manage too much. This article goes over what happened when we had too much infrastructure and the approach we took to solve it.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2yZbogF6Ibtu2EaV" /><figcaption>Photo by <a href="https://unsplash.com/@dallasreedy?utm_source=medium&amp;utm_medium=referral">Dallas Reedy</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Table of Contents</strong></p><ul><li><a href="#6b7f">Our problem statement</a></li><li><a href="#94fe">Splitting out the Serverless</a></li><li><a href="#f7ad">The Process</a></li><li><a href="#bbff">Problem one: custom module import errors</a></li><li><a href="#1b4b">Problem two: library import errors</a></li><li><a href="#f0c2">Unknown territory: step functions</a></li><li><a href="#e4b3">Custom variables: lets not duplicate those</a></li><li><a href="#7b1b">Deployments</a></li><li><a href="#9454">Conclusion</a></li></ul><p>In AWS, manually deploying and maintaining any more than a few resources is inefficient and not viable if you have plans to scale up. Luckily, the <a href="https://www.serverless.com/">Serverless Framework</a> takes much of that effort out of managing AWS resources and their configuration, however, start deploying too much and you’ll face different issues.</p><h3>Our problem statement</h3><p>After deploying somewhere to the tune of 60 lambdas, 5 step functions and an API gateway, we had a single serverless.yml file which was 900+ lines of YAML in length and managed our entire serverless estate. This caused some problems for us:</p><ol><li>Our deploys were taking ~8 minutes per run, as all our serverless estate was being redeployed with each change.</li><li>Our serverless.yml file was horrible to read and navigate, which acted as a barrier to entry for others and made it hard to contribute to our work.</li><li>Our automatically generated AWS policy, which controls permissions for these resources, grew too big. We could not create more infrastructure.</li><li><strong><em>Very importantly, </em></strong>if one of our team had their local code deployed to our dev environment, their changes were undone if another team member deployed their code which affects an unrelated service.</li></ol><p>All of the above <strong>really</strong> slowed us down; we did not have a smooth deployment process, our dev work was being severely impacted and our team habits were shifting to suit this poor setup.</p><h3>Splitting out the Serverless</h3><p>Our infrastructure consists of many smaller services that all (for the most part) function in isolation. So, <em>why</em> <em>manage all these services in one deployment file?</em> Well, when we started, it was just a few lambda functions and we sort of just ended up here. Time for a change!</p><p>The first logical step was to swap from managing all of the services in one serverless.yml file, to instead deploying each one as its own service. This splitting up seemed to come with many benefits:</p><ul><li>Multiple, but shorter, serverless.yml files would be easier to maintain and less daunting to look at.</li><li>Our deploys would be quicker and would not impact the deployment of services that other engineers were developing in our estate.</li><li>Services would have their own API Keys for their API Gateways. Contrary to having one “Skeleton Key” API Key, this approach reduces the impact if a key was leaked.</li></ul><p>That all sounded <em>dreamy</em>, so we began extracting files from our main serverless.yml file and re-homing them in their own directories. What did that process look like?</p><h3>The Process</h3><p>The first step to restructuring is making extra files. In this case, 17 serverless.yml files, one for each new service, that shared the same basic properties from our original serverless configuration. Our file structure originally looked like:</p><pre>atlassian-tools <br>  |-automation_scripts<br>    |-automation_one <br>    |-automation_two <br>    |-modules <br>    |-serverless.yml<br>    |-requirements.txt</pre><p>By splitting out the serverless file into lots of smaller services, our structure changed to:</p><pre>atlassian-tools<br>  |-automation_scripts<br>    |-automation_one<br>      |-serverless.yml<br>    |-automation_two<br>      |-serverless.yml<br>    |-modules<br>    |-requirements.txt</pre><p>As part of the splitting out, we copied the same basic configuration for each new service from the original:</p><pre>service: # Left blank for demo purposes<br><br>plugins:<br>  - serverless-python-requirements<br>  - serverless-step-functions<br><br>provider:<br>  name: aws<br>  versionFunctions: false<br>  runtime: python3.9<br>  stage: dev<br>  region: eu-west-1<br>  timeout: 30<br>  environment:<br>  apiGateway:<br>    apiKeys:<br>      - &quot;&quot; # Left blank for demo purposes<br>  iam:<br>    role:<br>      statements:<br>        - Effect: Allow<br>          Action: &quot;ssm:*&quot;<br>          Resource: &quot;*&quot;<br>        - Effect: Allow<br>          Action: &quot;ses:*&quot;<br>          Resource: &quot;*&quot;<br>        - Effect: Allow<br>          Action: &quot;s3:*&quot;<br>          Resource: &quot;*&quot;<br>          <br>functions:<br><br>stepFunctions:</pre><p>By utilising the same serverless.yml structure across all the new services, we could ensure that all services were consistent in both their configuration in AWS, but also in their deployment code. Thus making it easier to spot patterns, and giving us a template for new functions.</p><p>After that, it was just a case of copying each services’ function and step function configuration out of the original serverless.yml and into its new service. We will discuss deployments later on, which involved re-making the resources, with new serverless deployment S3 buckets per service.</p><p>From there, in order to help reduce package sizes and increase deployment speed further, each services’ plugins and IAM policy was modified to only include what was needed by its functions. This solved problem three of our initial problem statement; we no longer had one huge policy, we instead had many smaller policies.</p><p><em>However, with restructuring came some other issues and solutions…</em></p><h3>Problem one: custom module import errors</h3><p>By moving the serverless files one level down, the packages were changed and now no longer included our library of custom made modules. To fix this, we explicitly tell each serverless to package up that directory:</p><pre> package:<br>  patterns:<br>    - &quot;../modules/**&quot;</pre><p>A simple fix to a problem that could have blocked the whole project.</p><h3>Problem two: library import errors</h3><p>In our original deployment, we utilised the <a href="https://www.serverless.com/plugins/serverless-python-requirements">serverless-python-requirements</a> plugin to handle our additional libraries. By including a requirements.txt file in the package, each lambda would be deployed with the libraries it needed, including commonly used ones such as requests and boto3.</p><p>Since we were no longer including a requirements.txt in our new services, the serverless-python-requirements plugin no longer knew what to package to satisfy the dependencies in our lambdas. This gave us a great opportunity to move to lambda layers.</p><p>Layers are a method of packaging libraries together and assigning them to lambdas for use as imports. This means that we can package up and deploy these libraries once and reuse them as many time as we like. Since layers are persistent between deployments, it gave us another opportunity to improve our deployment times.</p><p>However, this in itself presented a new problem: <em>how to create these layers, but then also share them across 20 services?</em></p><ul><li>Creating shared configuration wouldn’t work as each service would deploy them and increase the version number.</li><li>It would also be impractical to make layers specific to each lambda.</li></ul><p>Solution?</p><p>Simple: make another service.</p><p>By creating one more directory, we dedicated an extra deployment service solely to managing the creation of layers.</p><pre>atlassian-tools<br>|-automation_scripts<br>  |-automation_one<br>    |-serverless.yml<br>  |-automation_two<br>    |-serverless.yml<br>  |-modules<br>  |- lambda_layers<br>    |-main<br>      |-requirements.txt<br>    |- pygithub<br>      |-requirements.txt<br>    |-serverless.yml<br>  |-requirements.txt</pre><pre>service: lambda-layers<br><br>provider:<br>  name: aws<br>  runtime: python3.9<br>  stage: dev<br>  region: eu-west-1<br><br>layers:<br>  main:<br>    path: main<br>    compatibleRuntimes:<br>      - python3.9<br>    retain: false<br>    description: &quot;lambda layer containing boto3, requests, black, httpx and msal&quot;<br><br>  pygithub:<br>    path: pygithub<br>    compatibleRuntimes:<br>      - python3.9<br>    retain: false<br>    description: &quot;lambda layer containing pygithub&quot;</pre><p>This had two primary benefits:</p><ol><li>By removing the layer deployment from the other services, we had more control over the versioning of the layers</li><li>We can drastically reduce the size of each service’s package and thus reduce deployment times</li></ol><p>To actually use the layers, we store their ARN references in environment variables in a globally shared custom file (more on that later) and use that value for the layers block in each of our lambdas</p><h3>Unknown territory: step functions</h3><p>Across our infrastructure, we have 5 step functions — pipelines of lambdas that run sequentially with the same input. These step functions share some identical lambdas that we consolidated to reduce repeated code. Ideally, we wanted to keep this setup.</p><p>We can’t deploy those shared lambdas in each service since they would have the same name, which isn’t possible.</p><p>We also don’t want to rename each lambda as its deployed as that would quadruple how much infrastructure we had to deploy for one change and defeat the purpose of consolidating them to reduce repeated code in the first place.</p><p>The solution was to create yet another service.</p><p>By deploying the shared lambdas on their own, outside of the services the hope was that we could then just tell the step functions where to find these lambas, and it would use them.</p><p>The result was a success.</p><p>By creating another environment variable specifying our AWS account numbers, we can once again use the ARN’s of the lambdas, rather than the previous reference format we used when it was a single service.</p><p>Going from:</p><pre>new-user-invite-to-directory:<br>  ResultPath: null<br>  Type: Task<br>  Resource:<br>    Fn::GetAtt: [new-user-invite-to-tenant, Arn]</pre><p>to</p><pre>new-user-invite-to-directory:<br>  ResultPath: &quot;$.taskresult&quot;<br>  Type: Task<br>  Resource: arn:aws:lambda:eu-west-1:${self:custom.account_number.<br>            ${opt:stage, self:provider.stage}}:function:<br>            new-user-invite-to-tenant</pre><p>So despite the defined resource being longer and harder to read, the setup becomes just as simple as with our previous setup.</p><h3>Custom variables: lets not duplicate those</h3><p>Custom variables have been mentioned a couple of times and are another big player in our infrastructure. Having around 30 custom variables, we don’t want to duplicate these in every service (600 2 environment variables would be a LOT to manage), so we made another file: custom.yml and import that into each service.</p><pre>custom: ${file(../custom.yml)}</pre><p>From there, since not every custom variable is needed by each service, we only create the environment variables if and when they are needed, helping keep serverless file lengths down and maintainability up.</p><h3>Deployments</h3><p>I mentioned earlier that before we embarked on this restructure, our deploys were taking around 8 minutes each. For a single line change in one file, thats a LONG time to not have our pipelines up and running. A new approach was needed and what better time than whilst restructuring our entire codebase?</p><p>Heres the approach: instead of 1 big service, we now have 20 smaller services. It would be great if we could only deploy a service that had been edited in a branch or commit to reduce deploy times and allow for more collaboration.</p><p>Introducing the “paths-filter” <a href="https://github.com/dorny/paths-filter">repo on GitHub</a>. This gave us a very simple solution for detecting when a directory within a branch or commit had changes which would give us a useable output. We can combine that with if statements in our Github actions pipeline to then do targeted deploys:</p><pre># Setting up the step to use the paths-filter tool.<br><br> - uses: dorny/paths-filter@v2<br>   id: filter<br>   with:<br>    filters: |<br>    # filters allow you to specify the paths that the tool<br>    # will look for changes in.<br>      group_management_tools:<br>        - &#39;automation_scripts/group_management/**&#39;<br>    <br> # This is a standard serverless deploy block with a condition<br> # The result of &quot;filter&quot; in the block above must contain<br> # &quot;group_management_tools&quot; in order for the service to deploy<br><br> - name: group_management_tools_deploy<br>   if: steps.filter.outputs.group_management_tools == &#39;true&#39;<br>   run: |<br>    cd ./automation_scripts/group_management &amp;&amp; sls deploy --stage prod</pre><p>Using this new deployment method, if just a single service is modified, deploy times are now down to around a minute.</p><h3>Conclusion</h3><p>So, to conclude: despite going from a single serverless file and a requirements.txt to 18 serverless files, we now have a repository with far easier to maintain infrastructure, more efficient packaging and deployment of that infrastructure and a far simpler way for multiple developers to work on the repo simultaneously.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bca52600a26d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kpmg-uk-engineering/serverless-restructuring-sometimes-more-files-is-a-good-thing-bca52600a26d">Serverless Restructuring — Sometimes more files is a good thing</a> was originally published in <a href="https://medium.com/kpmg-uk-engineering">KPMG UK Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>