<?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 Shahar Yakov on Medium]]></title>
        <description><![CDATA[Stories by Shahar Yakov on Medium]]></description>
        <link>https://medium.com/@shahar321?source=rss-27275da8387c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Glvvul92QZLO5KiTA3g-1A.jpeg</url>
            <title>Stories by Shahar Yakov on Medium</title>
            <link>https://medium.com/@shahar321?source=rss-27275da8387c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 11:40:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shahar321/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[Using a single GitHub App when working with multiple accounts]]></title>
            <link>https://medium.com/altostra/using-a-single-github-app-when-working-with-multiple-accounts-b061ca634525?source=rss-27275da8387c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b061ca634525</guid>
            <category><![CDATA[access-token]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[github-api]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Shahar Yakov]]></dc:creator>
            <pubDate>Mon, 01 Feb 2021 17:39:33 GMT</pubDate>
            <atom:updated>2021-02-01T17:39:33.658Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to use GitHub API to manage access tokens and installation IDs to enable working with multiple GitHub accounts within your application</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pP2DLP90JS1UaQ4DWl-j7Q.jpeg" /></figure><p>Altostra is a no-code infrastructure platform for developers and teams to accelerate cloud applications delivery.</p><p>As a developer-first platform, we use git providers for identity as well as for source control. In this article, we’ll discuss how we utilize GitHub for managing multiple teams on Altostra.</p><p>Using the <a href="https://github.com/marketplace/altostra">Altostra GitHub App</a>, we can integrate with our users’ GitHub accounts and perform operations, such as creating a repository or committing files, as Altostra. This enables our users to manage their Altostra projects inside their GitHub accounts.</p><h3>Storytime</h3><p>Bob is a developer in an organization with multiple development teams that use Altostra.</p><p>First, Bob connects his GitHub account by installing the Altostra GitHub App. After that, Bob can immediately start working with Altostra by importing existing projects from GitHub and creating new Altostra projects from templates.</p><p>Later, Bob creates a new team and wants to connect his GitHub account to it. This time, we can’t use the previous GitHub installation workflow because the app was already installed on Bob’s GitHub account. So, we <a href="https://docs.github.com/en/rest/reference/apps#list-app-installations-accessible-to-the-user-access-token">list</a> all the GitHub accounts that Bob has access to and already have the Altostra GitHub App installed.</p><p>Now, Bob can choose an existing installation or connect a new one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-g0_NvDniWljvbKe-P42lw.png" /></figure><h3>The Challenge</h3><p>At first, the relation between an Altostra account to a GitHub App installation (AKA <strong>“installation”</strong>) was a 1–1 relation, which means that a GitHub account could be connected to only a single Altostra account.</p><p>This limitation created a challenge because our users need to use the same GitHub App installation across many accounts, which breaks the 1–1 relation.</p><p>To overcome this challenge, we had to come up with a way to manage the GitHub App installations with Altostra’s accounts and allow the reuse of the installations on many accounts.</p><p>In Bob’s story, we used two types of access tokens, a “user access token” and an “app access token” each is used for different purposes. Let’s dive in.</p><h3>GitHub access tokens</h3><p>While some Github API operations don’t require any special permissions (listing pubic repositories, getting public user data, and so on), others require authentication in the form of an access token, such as create a repository, create PR, commit files, etc.</p><p>We use two types of tokens:</p><ul><li>User access tokens — Allows us to act on the user’s behalf.</li><li>App access tokens — Allows us to act on the app’s behalf.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z1urvJ7Im1eUPVEgg_6ZNA.gif" /><figcaption>Installed GitHub Apps = App access token. Authorized GitHub Apps = User access token.</figcaption></figure><h4>User access token</h4><p>The user access token allows us to perform actions on behalf of the user. We use this token for two operations:</p><ul><li>List the GitHub accounts that already installed our app, to which the authenticated user has access (check out the related <a href="https://docs.github.com/en/rest/reference/apps#list-app-installations-accessible-to-the-user-access-token">documentation</a>).</li><li>Create a repository on a personal GitHub account (check out the related <a href="https://docs.github.com/en/rest/reference/repos#create-a-repository-for-the-authenticated-user">documentation</a>). GitHub doesn’t support creating repositories on personal accounts by using the App access token.</li></ul><p>Before we can generate a user access token, the user must authorize our GitHub App. This can be done in two ways:</p><ol><li>Explicitly ask the user to <a href="https://docs.github.com/en/developers/apps/authorizing-oauth-apps#1-request-a-users-github-identity">authorize through GitHub</a> using the app’s client ID.</li><li>Request user authorization (OAuth) during app installation. To do so, manually enable this setting. It is located under the app “Identifying and authorizing users” section.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tizFBKKuv6Sx0_Q0aap1Cg.png" /><figcaption>App Settings / General / Identifying and authorizing users</figcaption></figure><p>In both ways, the user will be redirected to a URL you provided with a code as a query string parameter. Using the code, the app client-id and the appclient-secret we can generate the user access token.</p><p>Both the client-id and the client-secret located in the GitHub App page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a54f8a9b25f0a13fbd535bd18af1fdc7/href">https://medium.com/media/a54f8a9b25f0a13fbd535bd18af1fdc7/href</a></iframe><p>You can read more about it in the <a href="https://docs.github.com/en/developers/apps/identifying-and-authorizing-users-for-github-apps#2-users-are-redirected-back-to-your-site-by-github">documentation</a>.</p><p><strong>Refresh Tokens</strong></p><p><a href="https://docs.github.com/en/developers/apps/refreshing-user-to-server-access-tokens#renewing-a-user-token-with-a-refresh-token">Refresh tokens</a> are supported as an optional feature. To enable it, go to the App settings / Optional features / User-to-server token expiration and click opt-in.</p><p>Be aware that each refresh token is for a single-use. Each time you use it, a new refresh token is generated and the previous one becomes invalid. It is crucial that you correctly store and manage the refresh token to avoid losing it, which would require you to request the authorization again.</p><h4>App access token</h4><p>The App access token allows us to perform actions on behalf of the GitHub app. This access token is generated by providing the app-id, app-secret and the app installation-id for the GitHub account to which you request access.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/996e43a2ebe05b6e736ba174580a51cb/href">https://medium.com/media/996e43a2ebe05b6e736ba174580a51cb/href</a></iframe><p>You can read more about creating app access tokens in the <a href="https://docs.github.com/en/rest/reference/apps#create-an-installation-access-token-for-an-app">documentation</a>, and also about an issue with expiration times, that we faced, <a href="https://stackoverflow.com/questions/61770501/github-api-returns-401-while-trying-to-generate-access-token/61872948#61872948">here</a>.</p><h3>Webhooks</h3><p>Webhooks allow us to subscribe to GitHub App events. Using webhooks, we can react to events that happen to the GitHub App. For example, here are some of the webhooks that we use to manage the Altostra GitHub app:</p><ol><li>App was installed — store the app installation information for future use.</li><li>App was removed — disconnect the accounts associated with the app and remove the installation information.</li><li>App authorization revoked — remove access token.</li></ol><p>You can read more about webhooks <a href="https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads">here</a> and how to <a href="https://docs.github.com/en/developers/webhooks-and-events/securing-your-webhooks">secure</a> them.</p><h3>Finally</h3><p>Understanding the GitHub App workflows helped us provide our users with the best experience working with multiple teams and GitHub accounts.</p><p>Using the access tokens, webhooks, and APIs mentioned in this post, we created a robust solution to manage Altostra users’ GitHub accounts.</p><p>We intentionally avoided going into implementation details, as they are relevant only for us. We hope that the information above is enough to set you on the correct path to building your own solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b061ca634525" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altostra/using-a-single-github-app-when-working-with-multiple-accounts-b061ca634525">Using a single GitHub App when working with multiple accounts</a> was originally published in <a href="https://medium.com/altostra">Altostra</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to reduce Lambda invocations using SNS filter-policy]]></title>
            <link>https://medium.com/altostra/how-to-reduce-lambda-invocations-using-sns-filter-policy-e9b9ebcedba4?source=rss-27275da8387c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9b9ebcedba4</guid>
            <category><![CDATA[cloud-infrastructure]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[sns]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Shahar Yakov]]></dc:creator>
            <pubDate>Thu, 12 Nov 2020 15:25:28 GMT</pubDate>
            <atom:updated>2020-11-12T15:25:28.025Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let AWS filter your messages and save you time and money</h4><p>Originally published on <a href="https://www.altostra.com/blog/aws-sns-subscription-filter-policy">Altostra</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ceTdFZnQqpLD3CNp7I0NTA.png" /></figure><h3>Motivation</h3><p>At Altostra, we work with a serverless distributed system and use a message bus for communication between our system components. Early on, we implemented our message bus using an SNS topic. See our <a href="https://www.altostra.com/blog/aws-pub-sub">previous post</a> for other potential solutions.</p><p>By design, SNS sends messages to all subscribers — but at some point, we wanted to limit that each subscriber will get only the messages relevant to its functionality.</p><h3>How it works</h3><p>We want our system components to receive only relevant messages and nothing more. That’s when the filter-policy feature of SNS got into the picture.</p><p>SNS filter-policy enables you to filter messages by setting a set of filter-rules on every subscription. We move the message filtering responsibility from our code to AWS, thus reducing Lambda invocations, costs and code(switch cases, over-abstraction and so on). The filter-policy filters the messages according to the MessageAttributes attribute of the SNS message.</p><p>For example, a filter-policy which accepts only messages with an event_type of deployment_started looks like this:</p><pre>{<br>  &quot;event_type&quot;: [&quot;deployment_started&quot;]<br>}</pre><p>The filter-policy introduces a set of rules, restricted to the types String, String.Array and Number, and several operators such as equals, in, not in, mathematical operators (only for theNumber type), and more. Check out the full list <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-subscription-filter-policies.html#subscription-filter-policy-constraints">here</a>.</p><p>A filter-policy can be a simple condition on a single property or a complex condition, which then operates with the AND operator between properties and the OR operator between the property values. For example, this filter policy:</p><pre>{<br>  &quot;event_type&quot;: [&quot;deployment_started&quot;, &quot;deployment_finshed&quot;,],<br>  &quot;vendor_id&quot;: [{&quot;anything-but&quot;: 101}]<br>}</pre><p>accepts messages where the event_type is deployment_started <strong>or</strong> deployment_finshed <strong>AND</strong> the vendor_id is not 101.</p><p>An SNS message publishing code that passes the filter above would be:</p><pre><strong>const</strong> AWS = require(&#39;aws-sdk&#39;);<br><br><strong>async</strong> <strong>function</strong> <strong>publishMessage</strong>(message, topicArn) {<br>  <strong>const</strong> sns = <strong>new</strong> AWS.SNS()<br><br>  <strong>const</strong> messageParams = {<br>    Message: message,<br>    TopicArn: topicArn,<br>    MessageAttributes: {<br>      event_type: {<br>        DataType: &#39;String&#39;,<br>        StringValue: &#39;deployment_started&#39;<br>      },<br>      vendor_id: {<br>        DataType: &#39;Number&#39;,<br>        StringValue: &#39;200&#39;<br>      }<br>    }<br>  }<br><br>  <strong>await</strong> sns.publish(messageParams).promise()<br>}</pre><h3>Lets get our hands dirty</h3><p>In the example below, I’ll demonstrate a full flow of:</p><ol><li>Subscribing Lambdas to SNS</li><li>Add a filter-policy to each subscription</li><li>Publish messages according to the filter policy, and show you the logs of each Lambda</li></ol><p>Using Altostra designer, I will quickly build the architecture, subscribe Lambdas to SNS and add filter policy to each subscription. I will show you the logs in the AWS web console.</p><h4>Subscribe Lambdas to an SNS</h4><p>First, let’s create two Lambda functions and connect them to an SNS topic.</p><p>LambdaA handler will print LambdaA: + the message</p><p>LambdaB handler will print LambdaB: + the message</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8kJWtr6IG6q-Tj2um1Z4SQ.gif" /></figure><h4>Add the filter policy</h4><p>Now, let’s add a filter-policy to each Lambda, LambdaA accepts messages when the type attribute equals hello and LambdaB when the type attribute equals world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7dtuoXAdzXzJM8QYI8DvA.gif" /></figure><h4>Publish!</h4><p>Finally, let’s publish two messages to the SNS topic, one with the hello type and the other with the world type. After that, I&#39;ll show you the logs for each Lambda.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Drq7aWIPy4Uhht5cyEOyXQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9b9ebcedba4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altostra/how-to-reduce-lambda-invocations-using-sns-filter-policy-e9b9ebcedba4">How to reduce Lambda invocations using SNS filter-policy</a> was originally published in <a href="https://medium.com/altostra">Altostra</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multipart uploads with S3 pre-signed URLs]]></title>
            <link>https://medium.com/altostra/multipart-uploads-with-s3-pre-signed-urls-d98712cc4da2?source=rss-27275da8387c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d98712cc4da2</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[presigned-url]]></category>
            <dc:creator><![CDATA[Shahar Yakov]]></dc:creator>
            <pubDate>Wed, 08 Jul 2020 13:32:02 GMT</pubDate>
            <atom:updated>2020-07-08T18:25:41.392Z</atom:updated>
            <content:encoded><![CDATA[<h4>Breaking an object into pieces, uploading it to S3 in a secure way and constructing it to one piece</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ywkGJ-Zhohw3fsQ2iL3fwg.jpeg" /></figure><p>Originally posted on <a href="https://www.altostra.com/blog/multipart-uploads-with-s3-presigned-url">Altostra</a></p><h3>Let’s get on the same page</h3><p>In my previous post, <a href="https://medium.com/altostra/working-with-s3-pre-signed-urls-fb0603fb2d64">Working with S3 pre-signed URLs</a>, I showed you how and why I used pre-signed URLs.<br>This time I faced another problem: I had to upload a large file to S3 using pre-signed URLs. To be able to do so I had to use multipart upload, which is basically uploading a single object as a set of parts, with the advantage of parallel uploading.<br>In the following article, I’ll describe how I combined and used multipart upload with pre-signed URLs.</p><p>A normal multipart upload looks like this:</p><ol><li>Initiate a multipart upload</li><li>Upload the object’s parts</li><li>Complete multipart upload</li></ol><p>For that to work with pre-signed URLs, we should add one more stage: generating pre-signed URLs for each part.<br>The final process looks like this:</p><ol><li>Initiate a multipart upload</li><li>Create pre-signed URLs for each part</li><li>Upload the object’s parts</li><li>Complete multipart upload</li></ol><p>Stages 1,2, and 4 are server-side stages, which require an AWS access key id &amp; secret, where stage number 3 is client-side.</p><p>Let’s explore each stage.</p><h4>Before we begin</h4><p>As in my previous post, in the examples below, I used the constants BUCKET_NAME and OBJECT_NAME to represent my bucket and object - replace these with your own as you see fit.<br>Also, there are placeholders for theaccesskeyId and secretAccessKey, you can read about them <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html">here</a>.</p><h4>Stage one — Initiate a multipart upload</h4><p>At this stage, we request from AWS S3 to initiate multipart upload, in response, we will get the UploadId which will associate each part to the object they are creating.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae00f98362c92ea4f048e7fbbb1c6a1d/href">https://medium.com/media/ae00f98362c92ea4f048e7fbbb1c6a1d/href</a></iframe><h4>Stage Two — Create pre-signed URLs for each part</h4><p>This stage is responsible for creating a pre-signed URL for each part. Each pre-signed URL is being signed with the UploadId and the PartNumber, because of that, we have to create a separate pre-signed URL for each part. The pre-signed URLs are being generated with the uploadPart method, which grants the user access to, obviously, upload a part.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3160575248b9fe05925c0926d338474/href">https://medium.com/media/f3160575248b9fe05925c0926d338474/href</a></iframe><h4>Stage Three — Upload the object’s parts</h4><p>At this stage, we will upload each part using the pre-signed URLs that were generated in the previous stage. You can see each part is set to be 10MB in size. S3 Multipart upload doesn&#39;t support parts that are less than 5MB (except for the last one).</p><p>After uploading all parts, the etag of each part that was uploaded needs to be saved. We will use the etag in the next stage to complete the multipart upload process.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/871aa91dcbcce81e9aeb0d7727d98891/href">https://medium.com/media/871aa91dcbcce81e9aeb0d7727d98891/href</a></iframe><h4>Stage Four — Complete multipart upload</h4><p>The last stage’s job is to inform to S3 that all the parts were uploaded. By giving the completeMultipartUpload function the etag of each part, S3 knows how to constructs the object from the uploaded parts.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea94f87678fae5620fe966fef6787da4/href">https://medium.com/media/ea94f87678fae5620fe966fef6787da4/href</a></iframe><h4>Extra Stage — Avoid extra charges</h4><p>If at any stage you want to abort the upload, you can do it with the functionabortMultipartUpload (you can read about it <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html">here</a>).<br>Be aware that after you initiate a multipart upload and upload one or more parts, to stop from being charged for storing the uploaded parts, you must either complete or abort the multipart upload. Amazon S3 frees up the space used to store the parts and stop charging you for storing them only after you either complete or abort a multipart upload. <br>As a best practice, Amazon recommends you configure a lifecycle rule (using the AbortIncompleteMultipartUpload action) to minimize your storage costs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d98712cc4da2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altostra/multipart-uploads-with-s3-pre-signed-urls-d98712cc4da2">Multipart uploads with S3 pre-signed URLs</a> was originally published in <a href="https://medium.com/altostra">Altostra</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working with S3 pre-signed URLs]]></title>
            <link>https://medium.com/altostra/working-with-s3-pre-signed-urls-fb0603fb2d64?source=rss-27275da8387c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb0603fb2d64</guid>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[presigned-url]]></category>
            <category><![CDATA[aws-s3-bucket]]></category>
            <dc:creator><![CDATA[Shahar Yakov]]></dc:creator>
            <pubDate>Mon, 15 Jun 2020 13:40:54 GMT</pubDate>
            <atom:updated>2020-06-15T13:40:54.417Z</atom:updated>
            <content:encoded><![CDATA[<h4>Grant temporary access to objects in AWS S3 buckets without the need to grant explicit permissions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ZaSKTqyUqtbqkHRlh7qIQ.png" /></figure><h3>TL;DR</h3><p>S3 pre-signed URLs grant temporary access to objects in AWS S3 buckets without the need to grant explicit permissions.</p><ul><li>Supports only GET and PUT requests.</li><li>Request headers must exactly match both when creating and using the URLs.</li></ul><h3>Motivation</h3><p>It’s a best practice to keep S3 buckets private and only grant public access when absolutely required. Then how can you grant your client access to an object without changing the bucket ACL, creating roles, or providing a user on your account? That’s where S3 pre-signed URLs come in.</p><h3>Pre-Signed URLs</h3><p>S3 pre-signed URLs are a form of an S3 URL that temporarily grants <strong>restricted access</strong> to a <strong>single</strong> S3 object to perform a <strong>single operation</strong> — either PUT or GET — for a predefined <strong>time limit</strong>.</p><p>To break it down:</p><ul><li>It is <strong>secure</strong> — the URL is signed using an AWS access key</li><li>It grants <strong>restricted access</strong> — only one of <strong>GET</strong> or <strong>PUT</strong> is allowed for a single URL</li><li>Only to a <strong>single</strong> object — each pre-signed URL corresponds to one object</li><li>With a <strong>time-constrained</strong> — the URL expires after a set timeout</li></ul><p>In the next section, we’ll use these properties to generate an S3 pre-signed URL. <br>So let’s jump over to some code samples.</p><h3>Key Points</h3><p>Building a solution with S3 pre-signed URLs is not without its pitfalls. Here are some pointers to save you valuable time:</p><ol><li>You must send the same HTTP headers — when accessing a pre-signed URL — as you used when you generated it. For example, if you generate a pre-signed URL with the Content-Type header, then you must also provide this header when you access the pre-signed URL. Beware that some libraries - for example, Axios - attach default headers, such as Content-Type, if you don&#39;t provide your own.</li><li>The default pre-signed URL expiration time is 15 minutes. Make sure to adjust this value to your specific needs. Security-wise, you should keep it to the minimum possible — eventually, it depends on your design.</li><li>To upload a large file — larger than 10MB — you need to use multi-part upload. I’ll cover this topic in my next post.</li><li>Pre-signed URLs support only the getObject, putObject and uploadPart functions from the AWS SDK for S3. It&#39;s impossible to grant any other access to an object or a bucket, such as listBucket.</li><li>Because of the previously mentioned AWS SDK functions limitation, you can’t use pre-signed URLs as Lambda function sources, since Lambda requires both listBucket and getObject access to an S3 object to use as a source.</li></ol><h3>Implementation</h3><p>Now that we have all the information we require let’s get to coding.</p><p>Each code sample section contains two parts, the producer of the URL and the consumer. I use the JavaScript AWS SDK to generate the pre-signed URLs and the Axios NPM package to access these URLs from the consumer using basic HTTP requests.</p><p>In the examples, I use the constants BUCKET_NAME and OBJECT_NAME to represent my bucket and object - replace these with your own as you see fit.<br>Also, there is a placeholder for theaccesskeyId and secretAccessKey, you can read about it <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html">here</a>.</p><h4><strong>Generating S3 pre-signed URLs — The Producer</strong></h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c6df83f1868cde8107ecc861aecc018/href">https://medium.com/media/9c6df83f1868cde8107ecc861aecc018/href</a></iframe><h4>Accessing S3 objects using pre-signed URLs — The Consumer</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fcb4a1308fba4808f789149b7f7de9c/href">https://medium.com/media/3fcb4a1308fba4808f789149b7f7de9c/href</a></iframe><p><strong>Further Reading</strong></p><ul><li><a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls.html">Use signed URLs</a></li><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html">Share an object with others</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb0603fb2d64" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altostra/working-with-s3-pre-signed-urls-fb0603fb2d64">Working with S3 pre-signed URLs</a> was originally published in <a href="https://medium.com/altostra">Altostra</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>