I would love to get a new public IP every time I make a request. Is it possible to purposefully trigger my container to be recycled, or otherwise cause my IP to be reprovisioned?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- How to generate 12 digit unique number in redshift
- Use awslogs with kubernetes 'natively'
- Why wrapping a function into a lambda potentially
- google-drive can't get push notifications
相关文章
- node连接远程oracle报错
- Right way to deploy Rails + Puma + Postgres app to
- how many objects are returned by aws s3api list-ob
- Why doesn't C11 support lambda functions
- How can make folder with Firebase Cloud Functions
- AWS S3 in rails - how to set the s3_signature_vers
- Passthrough input to output in AWS Step Functions
- @angular-cli install fails with deprecated request
By default, a Lambda function is invoked from a private IP within one or more subnets in your VPC, according to your configuration. It is not configured with a public IP #; they are assigned private IPs.
If the requirement is to have the Lambda function assigned a public IP number, you would need to configure a NAT Gateway or NAT instance to provide internet access, and therefore a public IP. The Lambda traffic would then be attributed to the public IP address of the NAT gateway/instance.
An elastic IP address is assigned with a given NAT Gateway but it can't be reassigned - it is static. So a NAT Gateway would not work for your purpose.
You would have to use a NAT instance. The Lambda function would then need to terminate/launch the NAT instance at the end of each request. This would cause EC2 to assign a new public IP for your NAT instance - assuming the subnet it launches from is configured to auto-assign IP#s on launch.
Given that, you would have to restart the NAT instance after each request, in order for it to be assigned a new IP#. This process would allow for each request to be attributed to a new public IP# each time.
Please note that during the NAT instance launch/termination phase, your Lambda function would not have access to the internet. You could consider queueing the Lambda function using Simple Queuing Service to prevent contention to the NAT instance.
Scaling would also become an issue, as the functions would all require the NAT instance to be available for each invocation. If uptime and availability were a concern, you would need to implement a HA solution at the NAT service level.