You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to add a resource policy to allow traffic from a specific ip address but to a particular resource/method on the api gateway and not the api gateway itself.
const api = new RestApi(...);
let v1 = api.root.getResource('v1');
if (!v1) {
v1 = api.root.addResource('v1');
}
const resource = v1.addResource('resource');
const method = resource.addMethod('POST', integration, options);
const policyStatement = new PolicyStatement({
effect: Effect.ALLOW,
principals: [new AnyPrincipal()],
actions: ['execute-api:Invoke'],
resources: [method.methodArn],
conditions: {
IpAddress: {
'aws:SourceIp': '192.0.2.0'
}
}
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I would like to add a resource policy to allow traffic from a specific ip address but to a particular resource/method on the api gateway and not the api gateway itself.
I tried following -
but none of these worked
Does anyone know if is it even possible to do it via cdk code? Any help would be appreciated
Beta Was this translation helpful? Give feedback.
All reactions