I have been utilizing the Serverless Framework to deploy a Lambda function to AWS using Typescript. When connecting the Lambda to an existing VPC, it is necessary to specify the Subnet and Security Group IDs.
- Is there a method to obtain these values dynamically for my cloud account?
- Is it secure to store these actual IDs in a git repository, although I prefer not to do so?
index.ts displayed below:
import user from './schema'
import { handlerPath } from '@libs/handler-resolver'
export default {
handler: `${handlerPath(__dirname)}/handler.createuser`,
events: [
{
http: {
method: 'post',
path: 'user',
request: {
schemas: {
'application/json': user,
},
},
},
},
],
vpc: {
subnetIds: [
'subnet-1_ID',
'subnet-2_ID',
'subnet-3_ID',
], // Remember to replace with your actual Subnet IDs
securityGroupIds: ['sg-1_ID'], // Remember to replace with your actual Security Group ID
},
}