1.. _community.aws.lambda_info_module:
2
3
4*************************
5community.aws.lambda_info
6*************************
7
8**Gathers AWS Lambda function details**
9
10
11Version added: 1.0.0
12
13.. contents::
14   :local:
15   :depth: 1
16
17
18Synopsis
19--------
20- Gathers various details related to Lambda functions, including aliases, versions and event source mappings.
21- Use module :ref:`community.aws.lambda <community.aws.lambda_module>` to manage the lambda function itself, :ref:`community.aws.lambda_alias <community.aws.lambda_alias_module>` to manage function aliases and :ref:`community.aws.lambda_event <community.aws.lambda_event_module>` to manage lambda event source mappings.
22
23
24
25Requirements
26------------
27The below requirements are needed on the host that executes this module.
28
29- boto
30- boto3
31- python >= 2.6
32
33
34Parameters
35----------
36
37.. raw:: html
38
39    <table  border=0 cellpadding=0 class="documentation-table">
40        <tr>
41            <th colspan="1">Parameter</th>
42            <th>Choices/<font color="blue">Defaults</font></th>
43            <th width="100%">Comments</th>
44        </tr>
45            <tr>
46                <td colspan="1">
47                    <div class="ansibleOptionAnchor" id="parameter-"></div>
48                    <b>aws_access_key</b>
49                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
50                    <div style="font-size: small">
51                        <span style="color: purple">string</span>
52                    </div>
53                </td>
54                <td>
55                </td>
56                <td>
57                        <div>AWS access key. If not set then the value of the AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY or EC2_ACCESS_KEY environment variable is used.</div>
58                        <div>If <em>profile</em> is set this parameter is ignored.</div>
59                        <div>Passing the <em>aws_access_key</em> and <em>profile</em> options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.</div>
60                        <div style="font-size: small; color: darkgreen"><br/>aliases: ec2_access_key, access_key</div>
61                </td>
62            </tr>
63            <tr>
64                <td colspan="1">
65                    <div class="ansibleOptionAnchor" id="parameter-"></div>
66                    <b>aws_ca_bundle</b>
67                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
68                    <div style="font-size: small">
69                        <span style="color: purple">path</span>
70                    </div>
71                </td>
72                <td>
73                </td>
74                <td>
75                        <div>The location of a CA Bundle to use when validating SSL certificates.</div>
76                        <div>Only used for boto3 based modules.</div>
77                        <div>Note: The CA Bundle is read &#x27;module&#x27; side and may need to be explicitly copied from the controller if not run locally.</div>
78                </td>
79            </tr>
80            <tr>
81                <td colspan="1">
82                    <div class="ansibleOptionAnchor" id="parameter-"></div>
83                    <b>aws_config</b>
84                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
85                    <div style="font-size: small">
86                        <span style="color: purple">dictionary</span>
87                    </div>
88                </td>
89                <td>
90                </td>
91                <td>
92                        <div>A dictionary to modify the botocore configuration.</div>
93                        <div>Parameters can be found at <a href='https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config'>https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config</a>.</div>
94                        <div>Only the &#x27;user_agent&#x27; key is used for boto modules. See <a href='http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto'>http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto</a> for more boto configuration.</div>
95                </td>
96            </tr>
97            <tr>
98                <td colspan="1">
99                    <div class="ansibleOptionAnchor" id="parameter-"></div>
100                    <b>aws_secret_key</b>
101                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
102                    <div style="font-size: small">
103                        <span style="color: purple">string</span>
104                    </div>
105                </td>
106                <td>
107                </td>
108                <td>
109                        <div>AWS secret key. If not set then the value of the AWS_SECRET_ACCESS_KEY, AWS_SECRET_KEY, or EC2_SECRET_KEY environment variable is used.</div>
110                        <div>If <em>profile</em> is set this parameter is ignored.</div>
111                        <div>Passing the <em>aws_secret_key</em> and <em>profile</em> options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.</div>
112                        <div style="font-size: small; color: darkgreen"><br/>aliases: ec2_secret_key, secret_key</div>
113                </td>
114            </tr>
115            <tr>
116                <td colspan="1">
117                    <div class="ansibleOptionAnchor" id="parameter-"></div>
118                    <b>debug_botocore_endpoint_logs</b>
119                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
120                    <div style="font-size: small">
121                        <span style="color: purple">boolean</span>
122                    </div>
123                </td>
124                <td>
125                        <ul style="margin: 0; padding: 0"><b>Choices:</b>
126                                    <li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
127                                    <li>yes</li>
128                        </ul>
129                </td>
130                <td>
131                        <div>Use a botocore.endpoint logger to parse the unique (rather than total) &quot;resource:action&quot; API calls made during a task, outputing the set to the resource_actions key in the task results. Use the aws_resource_action callback to output to total list made during a playbook. The ANSIBLE_DEBUG_BOTOCORE_LOGS environment variable may also be used.</div>
132                </td>
133            </tr>
134            <tr>
135                <td colspan="1">
136                    <div class="ansibleOptionAnchor" id="parameter-"></div>
137                    <b>ec2_url</b>
138                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
139                    <div style="font-size: small">
140                        <span style="color: purple">string</span>
141                    </div>
142                </td>
143                <td>
144                </td>
145                <td>
146                        <div>Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used.</div>
147                        <div style="font-size: small; color: darkgreen"><br/>aliases: aws_endpoint_url, endpoint_url</div>
148                </td>
149            </tr>
150            <tr>
151                <td colspan="1">
152                    <div class="ansibleOptionAnchor" id="parameter-"></div>
153                    <b>event_source_arn</b>
154                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
155                    <div style="font-size: small">
156                        <span style="color: purple">string</span>
157                    </div>
158                </td>
159                <td>
160                </td>
161                <td>
162                        <div>When <em>query=mappings</em>, this is the Amazon Resource Name (ARN) of the Amazon Kinesis or DynamoDB stream.</div>
163                </td>
164            </tr>
165            <tr>
166                <td colspan="1">
167                    <div class="ansibleOptionAnchor" id="parameter-"></div>
168                    <b>function_name</b>
169                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
170                    <div style="font-size: small">
171                        <span style="color: purple">string</span>
172                    </div>
173                </td>
174                <td>
175                </td>
176                <td>
177                        <div>The name of the lambda function for which information is requested.</div>
178                        <div style="font-size: small; color: darkgreen"><br/>aliases: function, name</div>
179                </td>
180            </tr>
181            <tr>
182                <td colspan="1">
183                    <div class="ansibleOptionAnchor" id="parameter-"></div>
184                    <b>profile</b>
185                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
186                    <div style="font-size: small">
187                        <span style="color: purple">string</span>
188                    </div>
189                </td>
190                <td>
191                </td>
192                <td>
193                        <div>Uses a boto profile. Only works with boto &gt;= 2.24.0.</div>
194                        <div>Using <em>profile</em> will override <em>aws_access_key</em>, <em>aws_secret_key</em> and <em>security_token</em> and support for passing them at the same time as <em>profile</em> has been deprecated.</div>
195                        <div><em>aws_access_key</em>, <em>aws_secret_key</em> and <em>security_token</em> will be made mutually exclusive with <em>profile</em> after 2022-06-01.</div>
196                        <div style="font-size: small; color: darkgreen"><br/>aliases: aws_profile</div>
197                </td>
198            </tr>
199            <tr>
200                <td colspan="1">
201                    <div class="ansibleOptionAnchor" id="parameter-"></div>
202                    <b>query</b>
203                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
204                    <div style="font-size: small">
205                        <span style="color: purple">string</span>
206                    </div>
207                </td>
208                <td>
209                        <ul style="margin: 0; padding: 0"><b>Choices:</b>
210                                    <li>aliases</li>
211                                    <li><div style="color: blue"><b>all</b>&nbsp;&larr;</div></li>
212                                    <li>config</li>
213                                    <li>mappings</li>
214                                    <li>policy</li>
215                                    <li>versions</li>
216                        </ul>
217                </td>
218                <td>
219                        <div>Specifies the resource type for which to gather information.  Leave blank to retrieve all information.</div>
220                </td>
221            </tr>
222            <tr>
223                <td colspan="1">
224                    <div class="ansibleOptionAnchor" id="parameter-"></div>
225                    <b>region</b>
226                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
227                    <div style="font-size: small">
228                        <span style="color: purple">string</span>
229                    </div>
230                </td>
231                <td>
232                </td>
233                <td>
234                        <div>The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. See <a href='http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region'>http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region</a></div>
235                        <div style="font-size: small; color: darkgreen"><br/>aliases: aws_region, ec2_region</div>
236                </td>
237            </tr>
238            <tr>
239                <td colspan="1">
240                    <div class="ansibleOptionAnchor" id="parameter-"></div>
241                    <b>security_token</b>
242                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
243                    <div style="font-size: small">
244                        <span style="color: purple">string</span>
245                    </div>
246                </td>
247                <td>
248                </td>
249                <td>
250                        <div>AWS STS security token. If not set then the value of the AWS_SECURITY_TOKEN or EC2_SECURITY_TOKEN environment variable is used.</div>
251                        <div>If <em>profile</em> is set this parameter is ignored.</div>
252                        <div>Passing the <em>security_token</em> and <em>profile</em> options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.</div>
253                        <div style="font-size: small; color: darkgreen"><br/>aliases: aws_security_token, access_token</div>
254                </td>
255            </tr>
256            <tr>
257                <td colspan="1">
258                    <div class="ansibleOptionAnchor" id="parameter-"></div>
259                    <b>validate_certs</b>
260                    <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
261                    <div style="font-size: small">
262                        <span style="color: purple">boolean</span>
263                    </div>
264                </td>
265                <td>
266                        <ul style="margin: 0; padding: 0"><b>Choices:</b>
267                                    <li>no</li>
268                                    <li><div style="color: blue"><b>yes</b>&nbsp;&larr;</div></li>
269                        </ul>
270                </td>
271                <td>
272                        <div>When set to &quot;no&quot;, SSL certificates will not be validated for boto versions &gt;= 2.6.0.</div>
273                </td>
274            </tr>
275    </table>
276    <br/>
277
278
279Notes
280-----
281
282.. note::
283   - If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence ``AWS_URL`` or ``EC2_URL``, ``AWS_PROFILE`` or ``AWS_DEFAULT_PROFILE``, ``AWS_ACCESS_KEY_ID`` or ``AWS_ACCESS_KEY`` or ``EC2_ACCESS_KEY``, ``AWS_SECRET_ACCESS_KEY`` or ``AWS_SECRET_KEY`` or ``EC2_SECRET_KEY``, ``AWS_SECURITY_TOKEN`` or ``EC2_SECURITY_TOKEN``, ``AWS_REGION`` or ``EC2_REGION``, ``AWS_CA_BUNDLE``
284   - Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See https://boto.readthedocs.io/en/latest/boto_config_tut.html
285   - ``AWS_REGION`` or ``EC2_REGION`` can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file
286
287
288
289Examples
290--------
291
292.. code-block:: yaml
293
294    ---
295    # Simple example of listing all info for a function
296    - name: List all for a specific function
297      community.aws.lambda_info:
298        query: all
299        function_name: myFunction
300      register: my_function_details
301    # List all versions of a function
302    - name: List function versions
303      community.aws.lambda_info:
304        query: versions
305        function_name: myFunction
306      register: my_function_versions
307    # List all lambda function versions
308    - name: List all function
309      community.aws.lambda_info:
310        query: all
311        max_items: 20
312      register: output
313    - name: show Lambda information
314      ansible.builtin.debug:
315        msg: "{{ output['function'] }}"
316
317
318
319Return Values
320-------------
321Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
322
323.. raw:: html
324
325    <table border=0 cellpadding=0 class="documentation-table">
326        <tr>
327            <th colspan="1">Key</th>
328            <th>Returned</th>
329            <th width="100%">Description</th>
330        </tr>
331            <tr>
332                <td colspan="1">
333                    <div class="ansibleOptionAnchor" id="return-"></div>
334                    <b>function</b>
335                    <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
336                    <div style="font-size: small">
337                      <span style="color: purple">dictionary</span>
338                    </div>
339                </td>
340                <td>success</td>
341                <td>
342                            <div>lambda function list</div>
343                    <br/>
344                </td>
345            </tr>
346            <tr>
347                <td colspan="1">
348                    <div class="ansibleOptionAnchor" id="return-"></div>
349                    <b>function.TheName</b>
350                    <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
351                    <div style="font-size: small">
352                      <span style="color: purple">dictionary</span>
353                    </div>
354                </td>
355                <td>success</td>
356                <td>
357                            <div>lambda function information, including event, mapping, and version information</div>
358                    <br/>
359                </td>
360            </tr>
361    </table>
362    <br/><br/>
363
364
365Status
366------
367
368
369Authors
370~~~~~~~
371
372- Pierre Jodouin (@pjodouin)
373