Skip to content

Commit

Permalink
deploy: d1001ba
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshCasper committed Sep 16, 2023
1 parent 2bf809f commit 62749b2
Show file tree
Hide file tree
Showing 6 changed files with 391 additions and 23 deletions.
124 changes: 120 additions & 4 deletions categories/localstack-community/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,36 @@ The handler is then referenced by the filename of your lambda code and the funct
</span></span><span style="display:flex;"><span> --role arn:aws:iam::000000000000:role/lambda-role</span></span></code></pre></div>
<p>You can also check out some of our <a href="#deployment-configuration-examples">Deployment Configuration Examples</a>.</p>
<p>We can also quickly make sure that it works by invoking it with a simple payload:</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name my-cool-local-function --payload '{"action": "square", "number": 3}' output.txt</span></span></code></pre></div>
<ul class="nav nav-tabs" id="tabs-5" role="tablist">
<li class="nav-item">
<a class="nav-link active"
id="tabs-05-00-tab" data-toggle="tab" href="#tabs-05-00" role="tab"
aria-controls="tabs-05-00" aria-selected="false">
AWS CLI v1
</a>
</li><li class="nav-item">
<a class="nav-link"
id="tabs-05-01-tab" data-toggle="tab" href="#tabs-05-01" role="tab"
aria-controls="tabs-05-01" aria-selected="false">
AWS CLI v2
</a>
</li>
</ul>
<div class="tab-content" id="tabs-5-content">
<div class="tab-body tab-pane fade show active"
id="tabs-05-00" role="tabpanel" aria-labelled-by="tabs-05-00-tab">
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name my-cool-local-function \
</span></span><span style="display:flex;"><span> --payload '{"action": "square", "number": 3}' \
</span></span><span style="display:flex;"><span> output.txt</span></span></code></pre></div>
</div>
<div class="tab-body tab-pane fade"
id="tabs-05-01" role="tabpanel" aria-labelled-by="tabs-05-01-tab">
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name my-cool-local-function \
</span></span><span style="display:flex;"><span> --cli-binary-format raw-in-base64-out \
</span></span><span style="display:flex;"><span> --payload '{"action": "square", "number": 3}' \
</span></span><span style="display:flex;"><span> output.txt</span></span></code></pre></div>
</div>
</div>
<p>The invocation returns itself returns:</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-json" data-lang="json"><span style="display:flex;"><span><span style="color:#000;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#204a87;font-weight:bold">"StatusCode"</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#0000cf;font-weight:bold">200</span><span style="color:#000;font-weight:bold">,</span>
Expand Down Expand Up @@ -1539,9 +1568,38 @@ LocalStack’s Lambda container.</p>
</span></span><span style="display:flex;"><span> --code S3Bucket="hot-reload",S3Key="$(PWD)/dist" \
</span></span><span style="display:flex;"><span> --handler index.handler</span></span></code></pre></div>
<p>You can quickly make sure that it works by invoking it with a simple payload:</p>
<ul class="nav nav-tabs" id="tabs-10" role="tablist">
<li class="nav-item">
<a class="nav-link active"
id="tabs-10-00-tab" data-toggle="tab" href="#tabs-10-00" role="tab"
aria-controls="tabs-10-00" aria-selected="false">
AWS CLI v1
</a>
</li><li class="nav-item">
<a class="nav-link"
id="tabs-10-01-tab" data-toggle="tab" href="#tabs-10-01" role="tab"
aria-controls="tabs-10-01" aria-selected="false">
AWS CLI v2
</a>
</li>
</ul>
<div class="tab-content" id="tabs-10-content">
<div class="tab-body tab-pane fade show active"
id="tabs-10-00" role="tabpanel" aria-labelled-by="tabs-10-00-tab">
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke \
</span></span><span style="display:flex;"><span> --function-name hello-world \
</span></span><span style="display:flex;"><span> --payload '{"action": "test"}' \
</span></span><span style="display:flex;"><span> output.txt</span></span></code></pre></div>
</div>
<div class="tab-body tab-pane fade"
id="tabs-10-01" role="tabpanel" aria-labelled-by="tabs-10-01-tab">
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke \
</span></span><span style="display:flex;"><span> --function-name hello-world \
</span></span><span style="display:flex;"><span> --payload '{"action": "test"}' output.txt</span></span></code></pre></div>
</span></span><span style="display:flex;"><span> --cli-binary-format raw-in-base64-out \
</span></span><span style="display:flex;"><span> --payload '{"action": "test"}' \
</span></span><span style="display:flex;"><span> output.txt</span></span></code></pre></div>
</div>
</div>
<p>The invocation returns itself returns:</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span><span style="color:#ce5c00;font-weight:bold">{</span>
</span></span><span style="display:flex;"><span> <span style="color:#4e9a06">"StatusCode"</span>: 200,
Expand Down Expand Up @@ -2010,7 +2068,36 @@ The handler is then referenced by the filename of your lambda code and the funct
</span></span><span style="display:flex;"><span> --timeout 150 \
</span></span><span style="display:flex;"><span> --role arn:aws:iam::000000000000:role/lambda-role</span></span></code></pre></div>
<p>We can quickly verify that it works by invoking it with a simple payload:</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name my-cool-local-function --payload '{"message": "Hello from LocalStack!"}' output.txt</span></span></code></pre></div>
<ul class="nav nav-tabs" id="tabs-4" role="tablist">
<li class="nav-item">
<a class="nav-link active"
id="tabs-04-00-tab" data-toggle="tab" href="#tabs-04-00" role="tab"
aria-controls="tabs-04-00" aria-selected="false">
AWS CLI v1
</a>
</li><li class="nav-item">
<a class="nav-link"
id="tabs-04-01-tab" data-toggle="tab" href="#tabs-04-01" role="tab"
aria-controls="tabs-04-01" aria-selected="false">
AWS CLI v2
</a>
</li>
</ul>
<div class="tab-content" id="tabs-4-content">
<div class="tab-body tab-pane fade show active"
id="tabs-04-00" role="tabpanel" aria-labelled-by="tabs-04-00-tab">
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name my-cool-local-function \
</span></span><span style="display:flex;"><span> --payload '{"message": "Hello from LocalStack!"}' \
</span></span><span style="display:flex;"><span> output.txt</span></span></code></pre></div>
</div>
<div class="tab-body tab-pane fade"
id="tabs-04-01" role="tabpanel" aria-labelled-by="tabs-04-01-tab">
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name my-cool-local-function \
</span></span><span style="display:flex;"><span> --cli-binary-format raw-in-base64-out \
</span></span><span style="display:flex;"><span> --payload '{"message": "Hello from LocalStack!"}' \
</span></span><span style="display:flex;"><span> output.txt</span></span></code></pre></div>
</div>
</div>
<h2 id="debugging-jvm-lambdas">Debugging JVM lambdas</h2>
<h3 id="configure-localstack-and-your-lambda-function-for-remote-jvm-debugging">Configure LocalStack and your Lambda function for remote JVM debugging</h3>
<p>Set <code>LAMBDA_DOCKER_FLAGS</code> to export the <code>5050</code> (you can use any other port of your choice) port which your IDE debugger will connect to.</p>
Expand Down Expand Up @@ -2146,7 +2233,36 @@ then add the following configuration:</p>
<p>Now to debug your lambda function, click on the <code>Debug</code> icon with
<code>Attach to Remote Node.js</code> configuration selected, and then invoke your
lambda function:</p>
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name func1 test.lambda.log --payload '{"hello":"world"}'</span></span></code></pre></div>
<ul class="nav nav-tabs" id="tabs-7" role="tablist">
<li class="nav-item">
<a class="nav-link active"
id="tabs-07-00-tab" data-toggle="tab" href="#tabs-07-00" role="tab"
aria-controls="tabs-07-00" aria-selected="false">
AWS CLI v1
</a>
</li><li class="nav-item">
<a class="nav-link"
id="tabs-07-01-tab" data-toggle="tab" href="#tabs-07-01" role="tab"
aria-controls="tabs-07-01" aria-selected="false">
AWS CLI v2
</a>
</li>
</ul>
<div class="tab-content" id="tabs-7-content">
<div class="tab-body tab-pane fade show active"
id="tabs-07-00" role="tabpanel" aria-labelled-by="tabs-07-00-tab">
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name func1 \
</span></span><span style="display:flex;"><span> --payload '{"hello":"world"}' \
</span></span><span style="display:flex;"><span> output.txt</span></span></code></pre></div>
</div>
<div class="tab-body tab-pane fade"
id="tabs-07-01" role="tabpanel" aria-labelled-by="tabs-07-01-tab">
<div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span><span class="command-prefix">$ </span>awslocal lambda invoke --function-name func1 \
</span></span><span style="display:flex;"><span> --cli-binary-format raw-in-base64-out \
</span></span><span style="display:flex;"><span> --payload '{"hello":"world"}' \
</span></span><span style="display:flex;"><span> output.txt</span></span></code></pre></div>
</div>
</div>
<h2 id="resources">Resources</h2>
<ul>
<li><a href="https://github.com/localstack/localstack-pro-samples/tree/master/lambda-mounting-and-debugging">Lambda Code Mounting and Debugging (Python)</a></li>
Expand Down
Loading

0 comments on commit 62749b2

Please sign in to comment.