Questions tagged with AWS Lambda

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

2
answers
0
votes
22
views
asked 4 days ago

AWS Parameters and Secrets Lambda Extension does not work with parameter ARN's

The [AWS documentation](https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html#sample-commands-ps) for the Parameters and Secrets Lambda Extension states: ``` To make a call using the Amazon Resource Name (ARN) for a parameter, make an HTTP GET call similar to the following. GET http://localhost:port/systemsmanager/parameters/get?name=arn:aws:ssm:us-east-1:123456789012:parameter/MyParameter ``` however these requests return a 400 stating the parameter name is invalid. Here's a quick example to demonstrate the successful request using the parameter name, and the failed request using the parameter ARN: ```py import json import os from botocore.vendored import requests def lambda_handler(event, context): name_url = 'http://localhost:2773/systemsmanager/parameters/get?name=test-param' arn_url = 'http://localhost:2773/systemsmanager/parameters/get?name=arn:aws:ssm:us-east-2:{ACCOUNT_ID}:parameter/test-param' headers = {'X-Aws-Parameters-Secrets-Token': os.environ['AWS_SESSION_TOKEN']} name_resp = requests.get(name_url, headers=headers) print(f'NAME RESPONSE: {name_resp.status_code} > {name_resp.text}') arn_resp = requests.get(arn_url, headers=headers) print(f'ARN RESPONSE: {arn_resp.status_code} > {arn_resp.text}') ``` and the output: ``` NAME RESPONSE: 200 > {"Parameter":{"ARN":"arn:aws:ssm:us-east-2:{ACCOUNT_ID}:parameter/test-param","DataType":"text","LastModifiedDate":"2022-11-26T02:25:14.669Z","Name":"test-param","Selector":null,"SourceResult":null,"Type":"SecureString","Value":"AQICAH....=","Version":2},"ResultMetadata":{}} ARN RESPONSE: 400 > an unexpected error occurred while executing request [AWS Parameters and Secrets Lambda Extension] 2022/11/26 18:09:36 ERROR GetParameter request encountered an error: operation error SSM: GetParameter, https response error StatusCode: 400, RequestID: {REQUEST_ID}, api error ValidationException: Invalid parameter name. Please use correct syntax for referencing a version/label <name>:<version/label> ``` The docs also state: ``` When using GET calls, parameter values must be encoded for HTTP to preserve special characters. ``` however the error still occurs whether the ARN colons and/or slash are URL-encoded or not like so: ``` http://localhost:2773/systemsmanager/parameters/get?name=arn%3Aaws%3Assm%3Aus-east-2%3A{ACCOUNT_ID}%3Aparameter/test-param http://localhost:2773/systemsmanager/parameters/get?name=arn%3Aaws%3Assm%3Aus-east-2%3A{ACCOUNT_ID}%3Aparameter%2Ftest-param ``` Am I missing something here or is the documentation incorrect in that an ARN can be used for these requests?
0
answers
0
votes
43
views
andy
asked 4 days ago

C++ Lambda - segmentation fault

Hi, I am trying to create a lambda function with access to an S3 bucket and allow operations to the bucket such as create and delete files (the usual I assume). I installed (on my windows pc) a WSL instance of ubuntu 20.04 and I installed AWS CLI according to: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.htm I then followed the guide to configure and set access keys: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html Now, I followed the guide on creating a hello world lambda function in c++: https://aws.amazon.com/blogs/compute/introducing-the-c-lambda-runtime/ The first example, all is fine and the lambda function successfully runs from the aws console without any errors or warnings. Now, when I continue the same guide to the "beyond hello", things start going wrong. I successfully setup all what was needed and installed the SDK's as required. Now, when I try to make the project, the compiler stops with this message: ``` cpp-encoder-example/main.cpp:78:56: error: no matching function for call to ‘Aws::S3::S3Client::S3Client(std::shared_ptr<Aws::Auth::EnvironmentAWSCredentialsProvider>&, Aws::Client::ClientConfiguration&)’ 78 | S3::S3Client client(credentialsProvider, config); ``` followed by a few lines with this note where n = 5, 4 and 1. (line number is of the first warning thrown) ``` include/aws/s3/S3Client.h:96:9: note: candidate expects n arguments, 2 provided ``` Now, when I remove 'credentialsProvider' from S3::S3Client client(credentialsProvider, config); in main.cpp, all does compile. (should that work?) However, I then continue to create the lambda function and when created and I press test in the aws console, it stops with: ``` s2n_init() failed: 402653268 (Failed to load or unload an openssl provider) Fatal error condition occurred in /home/username/aws-sdk-cpp/crt/aws-crt-cpp/crt/aws-c-io/source/s2n/s2n_tls_channel_handler.c:197: 0 && "s2n_init() failed" Exiting Application No call stack information available START RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Version: $LATEST 2022-11-21T09:02:07.642Z xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Task timed out after 1.02 seconds END RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx REPORT RequestId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Duration: 1015.50 ms Billed Duration: 1000 ms Memory Size: 128 MB Max Memory Used: 16 MB ``` Now, for some reason I think something is failing during compile time with the certificates. What certificates may I not have set correctly, what installation step might I have missed? Have I failed at something else and can someone give me a pointer (pun not intended) to what to do / try? Ps. I'm not sure what tags to add since sdk or c++ are not included in them.
1
answers
0
votes
20
views
asked 6 days ago

Proper CMAF config for media convert

I am using AWS lambda to create a job for media convert (using python). I was convert an input video in CMAF H265 format, but I am unable to figure out the correct settings for this. The createJob function returns an error : `botocore.errorfactory.BadRequestException: An error occurred (BadRequestException) when calling the CreateJob operation: /outputGroups/0/outputs/0: Should match exactly one schema defined in "oneOf"` The error displayed in log files of lambda has only this information and does not mention the exact fields which are missing the validation. When i compare my config with the sdk code, I am unable to find the possible error. Please help here. Since the error is in outputs, including the corresponding object: ``` { "ContainerSettings": { "Container": "CMFC", "CmfcSettings": { "IFrameOnlyManifest": "EXCLUDE" } }, "VideoDescription": { "Width": 468, "ScalingBehavior": "DEFAULT", "Height": 264, "TimecodeInsertion": "DISABLED", "AntiAlias": "ENABLED", "Sharpness": 50, "CodecSettings": { "Codec": "H_265", "H265Settings": { "InterlaceMode": "PROGRESSIVE", "NumberReferenceFrames": 3, "GopClosedCadence": 1, "GopSize": 90, "Slices": 1, "GopBReference": "DISABLED", "SlowPal": "DISABLED", "SpatialAdaptiveQuantization": "ENABLED", "TemporalAdaptiveQuantization": "ENABLED", "FlickerAdaptiveQuantization": "DISABLED", "FramerateControl": "INITIALIZE_FROM_SOURCE", "RateControlMode": "QVBR", "QvbrSettings": { "QvbrQualityLevel": 7 }, "MaxBitrate": 500000, "CodecProfile": "MAIN_HIGH", "CodecLevel": "LEVEL_3", "Telecine": "NONE", "MinIInterval": 0, "AdaptiveQuantization": "HIGH", "SceneChangeDetect": "ENABLED", "QualityTuningLevel": "SINGLE_PASS_HQ", "FramerateConversionAlgorithm": "DUPLICATE_DROP", "UnregisteredSeiTimecode": "DISABLED", "GopSizeUnits": "FRAMES", "ParControl": "INITIALIZE_FROM_SOURCE", "NumberBFramesBetweenReferenceFrames": 2, "WriteMp4PackagingType":"HEV1" } }, "AfdSignaling": "NONE", "DropFrameTimecode": "ENABLED", "RespondToAfd": "NONE", "ColorMetadata": "INSERT" }, "AudioDescriptions": [ { "AudioTypeControl": "FOLLOW_INPUT", "CodecSettings": { "Codec": "AAC", "AacSettings": { "AudioDescriptionBroadcasterMix": "NORMAL", "Bitrate": 96000, "RateControlMode": "CBR", "CodecProfile": "LC", "CodingMode": "CODING_MODE_2_0", "RawFormat": "NONE", "SampleRate": 48000, "Specification": "MPEG4" } }, "LanguageCodeControl": "FOLLOW_INPUT" } ], "NameModifier": "_468" } ```
1
answers
0
votes
21
views
asked 7 days ago