I need to create an endpoint to access AWS Secrets Manager using CloudFormation for rotating secrets. At Using an AWS Secrets Manager VPC endpoint it says:
We recommend that you create a Secrets Manager endpoint in the same VPC so that requests from the Lambda rotation function to Secrets Manager don't leave the Amazon network.
At Access an AWS service using an interface VPC endpoint > Create a VPC endpoint it says:
For Security group, select the security groups to associate with the endpoint network interfaces. The security group rules must allow resources that will use the VPC endpoint to communicate with the AWS service to communicate with the endpoint network interface.
But it doesn't give me any insight into what specific rules I need to set up in this situation.
In the CloudFormation documentation to create an endpoint, AWS::EC2::VPCEndpoint
SecurityGroupIds
, it says:
The IDs of the security groups to associate with the endpoint network interfaces. If this parameter is not specified, we use the default security group for the VPC. …
The examples at AWS::SecretsManager::RotationSchedule
in fact show creation of a secrets manager endpoint, explicitly indicating the default security group for the VPC. (If that is the default, I don't know why they specify it.)
SecretsManagerVPCEndpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
SubnetIds:
- Ref: TestSubnet01
- Ref: TestSubnet02
SecurityGroupIds:
- Fn::GetAtt:
- TestVPC
- DefaultSecurityGroup
VpcEndpointType: Interface
ServiceName:
Fn::Sub: com.amazonaws.${AWS::Region}.secretsmanager
PrivateDnsEnabled: true
VpcId:
Ref: TestVPC
My question is if I want to rotate passwords using a lambda, what security group should I associate with the secrets manager endpoint? Is it most appropriate just to use the VPC default security group? Or is there some more specific security group that I should create to be more secure, and if so, what rules should it have?