So the steps seem to be, after modifying the serverless.yml as above
- create an SNS endpoint in the VPC (use the AWS console)
- from a function declared as being in the VPC, you do
const sns = new aws.SNS({endpoint:'https://.....'});
await sns.publish( {
Message: 'MESSAGE_TEXT',
TopicArn: 'TOPIC_ARN'
} ).promise()
- for a function decalared as outside the VPC, in serverless.yml give
events:
- sns: TOPIC_ARN
and it gets run
Using SES from a function outside the VPC just works, so this is a good approach, just a shame about the boilerplate “VPC” added to each “normal” function rather than being able to say “vpc:none” on the one special one.