feat(events-targets): support assignPublicIp flag to EcsTask#25660
feat(events-targets): support assignPublicIp flag to EcsTask#25660mergify[bot] merged 8 commits intoaws:mainfrom
Conversation
| }))).not.toThrow(); | ||
| }); | ||
|
|
||
| test('Isolated subnet does not have AssignPublicIp=true', () => { |
There was a problem hiding this comment.
We should not need to remove any tests.
There was a problem hiding this comment.
Sorry, I mistakenly removed the test. It's recovered.
| const subnetSelection = this.props.subnetSelection || { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }; | ||
| const assignPublicIp = subnetSelection.subnetType === ec2.SubnetType.PUBLIC ? 'ENABLED' : 'DISABLED'; | ||
|
|
||
| const assignPublicIp = (this.assignPublicIp ?? subnetSelection.subnetType == ec2.SubnetType.PUBLIC) ? 'ENABLED' : 'DISABLED'; |
There was a problem hiding this comment.
What about the case where assignPublicIp is set to true, but the subnetSelection is not public? Should we throw an error in that case?
There was a problem hiding this comment.
The public IP addresses can be enabled even in the private subnets. (of course, it's impossible to communicate with the Internet and a meaningless operation.)
I think we shouldn't throw an error in the case since it's the valid setting.
There was a problem hiding this comment.
I think that if the user explicitly sets assignPublicIp=true then we should throw an error if using private subnets. The user is clearly intending to have a public service or is making a misconfiguration. In either case we should throw an error.
| const subnetSelection = this.props.subnetSelection || { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }; | ||
| const assignPublicIp = subnetSelection.subnetType === ec2.SubnetType.PUBLIC ? 'ENABLED' : 'DISABLED'; | ||
|
|
||
| const assignPublicIp = (this.assignPublicIp ?? subnetSelection.subnetType == ec2.SubnetType.PUBLIC) ? 'ENABLED' : 'DISABLED'; |
There was a problem hiding this comment.
| const assignPublicIp = (this.assignPublicIp ?? subnetSelection.subnetType == ec2.SubnetType.PUBLIC) ? 'ENABLED' : 'DISABLED'; | |
| const assignPublicIp = (this.assignPublicIp ?? subnetSelection.subnetType === ec2.SubnetType.PUBLIC) ? 'ENABLED' : 'DISABLED'; |
|
|
||
| const assignPublicIp = (this.assignPublicIp ?? subnetSelection.subnetType == ec2.SubnetType.PUBLIC) ? 'ENABLED' : 'DISABLED'; | ||
| const launchType = this.taskDefinition.isEc2Compatible ? 'EC2' : 'FARGATE'; | ||
| if (assignPublicIp == 'ENABLED' && launchType != 'FARGATE') { |
There was a problem hiding this comment.
| if (assignPublicIp == 'ENABLED' && launchType != 'FARGATE') { | |
| if (assignPublicIp === 'ENABLED' && launchType !== 'FARGATE') { |
|
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
2 similar comments
|
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
|
This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state. |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This feature supports
assignPublicIptoEcsTask.It specifies whether the task's elastic network interface receives a public IP address.
You can enable it only when
LaunchTypeisFARGATE.In this commit, the choice logic of the
LaunchTypekeeps the backwards compatibility.Closes #9233
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license