Skip to content

AuthPolicy

Source: src/AWS/VpcLattice/AuthPolicy.ts

An auth policy for a VPC Lattice service network or service — the IAM resource policy evaluated on every request when the target’s authType is AWS_IAM.

Allow Authenticated Invoke on a Service Network

const network = yield* ServiceNetwork("SecureNetwork", {
authType: "AWS_IAM",
});
const authPolicy = yield* AuthPolicy("NetworkAuthPolicy", {
resourceIdentifier: network.serviceNetworkId,
policy: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: { AWS: "*" },
Action: ["vpc-lattice-svcs:Invoke"],
Resource: "*",
},
],
},
});

Raw JSON Escape Hatch

const authPolicy = yield* AuthPolicy("ServiceAuthPolicy", {
resourceIdentifier: service.serviceId,
policy: JSON.stringify({
Version: "2012-10-17",
Statement: [{ Effect: "Allow", Principal: "*", Action: "vpc-lattice-svcs:Invoke", Resource: "*" }],
}),
});