Skip to content

AuthorizeSecurityGroupIngress

Source: src/AWS/EC2/AuthorizeSecurityGroupIngress.ts

Runtime binding for the AuthorizeSecurityGroupIngress operation scoped to the bound SecurityGroup (IAM action ec2:AuthorizeSecurityGroupIngress on the security group ARN).

Adds an inbound rule to the group at runtime — the classic dynamic IP-allowlisting Lambda that opens a port for an operator’s current address. Pair with RevokeSecurityGroupIngress to remove the rule afterwards. Provide the implementation with Effect.provide(AWS.EC2.AuthorizeSecurityGroupIngressHttp).

// init — bind the operation to the security group
const authorizeIngress = yield* AWS.EC2.AuthorizeSecurityGroupIngress(group);
// runtime — open port 22 for the caller's address
yield* authorizeIngress({
IpProtocol: "tcp",
FromPort: 22,
ToPort: 22,
CidrIp: "203.0.113.7/32",
});