I'm super confused about how to use the endpoint for SSM so that Lambda on an isolated subnet can use ssm.GetParameter
According to this issue I need a VPC endpoint for SSM. I tried doing that like so:
// Create a security group:
this.vpcsg = new ec2.SecurityGroup(this, 'vpc-sg', {
vpc: this.vpc,
allowAllOutbound: false,
securityGroupName: 'VPCSecurityGroup'
})
// endpoint creation
this.vpcEndpointSSM = new ec2.InterfaceVpcEndpoint(this, `SSMVpcEndpoint`, {
service: ec2.InterfaceVpcEndpointAwsService.SSM,
vpc: this.vpc,
subnets: { subnetType: ec2.SubnetType.ISOLATED },
securityGroups: [this.ingressSecurityGroup]
})
// And then later I call...
this.lambdaGQLAPI = new lambda.Function(this, `LambdaAPI`, {
code: new lambda.AssetCode(lambdaNodePath),
vpc: this.vpc,
vpcSubnets: { subnetType: ec2.SubnetType.ISOLATED },
functionName: this.functions.api,
handler: 'lambda_graphql.handler',
memorySize: 256,
timeout: core.Duration.minutes(2),
runtime: lambda.Runtime.NODEJS_12_X,
securityGroups: [props.dbSecurityGroup, this.vpcsg],
})
I also have made sure that the lambda function should be able to access SSM using the policy simulator and that checks out
but then my function just times out trying to access SSM.