I have stored two subnets in aws ssm whose datatype is StringList
like this s1,s2
and in lambda function I want to attach these two subnets using cloudformation template.
Lambda function will put the data to postgres database so for that I need to attch these subnets.
AWSTemplateFormatVersion: "2010-09-09"
Transform: "AWS::Serverless-2016-10-31"
Resources:
ExportToS3Function:
Type: AWS::Serverless::Function
Properties:
FunctionName: testing-ssm
CodeUri: testing-ssm/
Environment:
Variables:
RDS_SECRET: XXXXXXX
REGION: !Sub "${AWS::Region}"
Handler: lambda_function.lambda_handler
Runtime: python3.8
Timeout: 600
MemorySize: 1750
VpcConfig:
SecurityGroupIds:
- '{{resolve:ssm:/testing/vpc/sg:1}}'
SubnetIds: !Split [',','{{resolve:ssm:/testing/vpc/subnets:1}}']
Role: !GetAtt testing-ssm.Arn
But above line !Split [',','{{resolve:ssm:/testing/vpc/subnets:1}}']
giving me an error while deploying
Resource handler returned message: "1 validation error detected: Value '[subnet-XXXXX, subnet-XXXXXX]' at 'vpcConfig.subnetIds' failed to satisfy constraint