Is it possible to specify an ingress rule that is ...
# aws
a
Is it possible to specify an ingress rule that is self-referential? Meaning, I want to create a security group that only allows access to a given port from other instances that are assigned to that same group. Pseudo code of how I would think it could work:
Copy code
consul_agent_security_group = ec2.SecurityGroup(
    f'consul-agent-{environment_name}-security-group',
    name=f'{environment_name}-consul-agent',
    description='Access control between Consul agents',
    tags=aws_config.merged_tags({'Name': f'{environment_name}-consul-agent'}),
    vpc_id=destination_vpc['id'],
    ingress=[
        ec2.SecurityGroupIngressArgs(
            security_groups=[self.id],
            protocol='tcp',
            from_port=8301,
            to_port=8301,
            description='LAN gossip protocol'
        )
    ]
)