- Newest
- Most votes
- Most comments
Your question is a little unclear: Are you trying to add a route to the EC2 instance (i.e. the operating system) or are you trying to add a route to the VPC that points to an instance?
If the latter, you can definitely use AWS::EC2::Route
to do that as one of the targets is the instance id. The route is then associated with a route table.
If the former (trying to add a route to the OS) - CloudFormation won't help you here as it doesn't provide configuration for operating systems of instances. However, what you could do is create UserData for the instance which would create the route on instance startup. However, UserData is only executed at first launch so this is not going to help with an instance that is already launched.
Normally though, adding routes to the VPC is good enough because the instance sends traffic to the VPC "router" and it sends traffic to the appropriate destination.
To attach a route table to a subnet, where the EC2 instance resides, see AWS::EC2::SubnetRouteTableAssociation.
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 16 days ago
- AWS OFFICIALUpdated 4 days ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 22 days ago