Identity-based policies for Amazon VPC Lattice
By default, users and roles don't have permission to create or modify VPC Lattice resources. They also can't perform tasks by using the AWS Management Console, AWS Command Line Interface (AWS CLI), or AWS API. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies. The administrator can then add the IAM policies to roles, and users can assume the roles.
To learn how to create an IAM identity-based policy by using these example JSON policy documents, see Create IAM policies (console) in the IAM User Guide.
For details about actions and resource types defined by VPC Lattice, including the format of the ARNs for each of the resource types, see Actions, Resources, and Condition Keys for Amazon VPC Lattice in the Service Authorization Reference.
Contents
Policy best practices
Identity-based policies determine whether someone can create, access, or delete VPC Lattice resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations:
-
Get started with AWS managed policies and move toward least-privilege permissions – To get started granting permissions to your users and workloads, use the AWS managed policies that grant permissions for many common use cases. They are available in your AWS account. We recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see AWS managed policies or AWS managed policies for job functions in the IAM User Guide.
-
Apply least-privilege permissions – When you set permissions with IAM policies, grant only the permissions required to perform a task. You do this by defining the actions that can be taken on specific resources under specific conditions, also known as least-privilege permissions. For more information about using IAM to apply permissions, see Policies and permissions in IAM in the IAM User Guide.
-
Use conditions in IAM policies to further restrict access – You can add a condition to your policies to limit access to actions and resources. For example, you can write a policy condition to specify that all requests must be sent using SSL. You can also use conditions to grant access to service actions if they are used through a specific AWS service, such as AWS CloudFormation. For more information, see IAM JSON policy elements: Condition in the IAM User Guide.
-
Use IAM Access Analyzer to validate your IAM policies to ensure secure and functional permissions – IAM Access Analyzer validates new and existing policies so that the policies adhere to the IAM policy language (JSON) and IAM best practices. IAM Access Analyzer provides more than 100 policy checks and actionable recommendations to help you author secure and functional policies. For more information, see Validate policies with IAM Access Analyzer in the IAM User Guide.
-
Require multi-factor authentication (MFA) – If you have a scenario that requires IAM users or a root user in your AWS account, turn on MFA for additional security. To require MFA when API operations are called, add MFA conditions to your policies. For more information, see Secure API access with MFA in the IAM User Guide.
For more information about best practices in IAM, see Security best practices in IAM in the IAM User Guide.
Additional required permissions for full access
To use other AWS services that VPC Lattice is integrated with and the entire suite of
VPC Lattice features, you must have specific additional permissions. These permissions are
not included in the VPCLatticeFullAccess
managed policy because of the
confused
deputy privilege escalation risk.
You must attach the following policy to your role and use it along with the
VPCLatticeFullAccess
managed policy.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "firehose:TagDeliveryStream", "lambda:AddPermission", "s3:PutBucketPolicy" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "logs:PutResourcePolicy" ], "Resource": "*", "Condition": { "ForAnyValue:StringEquals": { "aws:CalledVia": [ "vpc-lattice.amazonaws.com" ] } } }, { "Effect": "Allow", "Action": [ "iam:AttachRolePolicy", "iam:PutRolePolicy" ], "Resource": "arn:aws:iam::*:role/aws-service-role/vpc-lattice.amazonaws.com/AWSServiceRoleForVpcLattice" }, { "Effect": "Allow", "Action": [ "iam:AttachRolePolicy", "iam:PutRolePolicy" ], "Resource": "arn:aws:iam::*:role/aws-service-role/delivery.logs.amazonaws.com/AWSServiceRoleForLogDelivery*" } ] }
This policy provides the following additional permissions:
-
iam:AttachRolePolicy
: Allows you to attach the specified managed policy to the specified IAM role. -
iam:PutRolePolicy
: Allows you to add or update an inline policy document that is embedded in the specified IAM role. -
s3:PutBucketPolicy
: Allows you to apply a bucket policy to an Amazon S3 bucket. -
firehose:TagDeliveryStream
: Allows you to add or update tags for Firehose delivery streams.
Identity-based policy examples for VPC Lattice
Topics
Example policy: Manage VPC associations to a service network
The following example demonstrates a policy that gives users with this policy the permission to create, update, and delete the VPC associations to a service network, but only for the VPC and service network specified in the condition. For more information about specifying condition keys, see Policy condition keys for VPC Lattice.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "vpc-lattice:CreateServiceNetworkVpcAssociation", "vpc-lattice:UpdateServiceNetworkVpcAssociation", "vpc-lattice:DeleteServiceNetworkVpcAssociation" ], "Resource": [ "*" ], "Condition": { "StringEquals": { "vpc-lattice:ServiceNetworkArn": "arn:aws:vpc-lattice:us-west-2:
123456789012
:servicenetwork/sn-903004f88example
", "vpc-lattice:VpcId": "vpc-1a2b3c4d
" } } } ] }
Example policy: Create service associations to a service network
If you are not using condition keys to control access to VPC Lattice resources, you
can specify the ARNs of resources in the Resource
element to control
access instead.
The following example demonstrates a policy that limits the service associations
to a service network that users with this policy can create by specifying the ARNs of
the service and service network that can be used with the
CreateServiceNetworkServiceAssociation
API action. For more
information about specifying the ARN values, see Policy
resources for VPC Lattice.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "vpc-lattice:CreateServiceNetworkServiceAssociation" ], "Resource": [ "arn:aws:vpc-lattice:us-west-2:
123456789012
:servicenetworkserviceassociation/*", "arn:aws:vpc-lattice:us-west-2:123456789012
:service/svc-04d5cc9b88example
", "arn:aws:vpc-lattice:us-west-2:123456789012
:servicenetwork/sn-903004f88example
" ] } ] }
Example policy: Add tags to resources
The following example demonstrates a policy that gives users with this policy permission to create tags on VPC Lattice resources.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "vpc-lattice:TagResource" ], "Resource": "arn:aws:vpc-lattice:us-west-2:
123456789012
:*/*" } ] }
Example policy: Create a service-linked role
VPC Lattice requires permissions to create a service-linked role the first time that any user in your AWS account creates VPC Lattice resources. If the service-linked role does not exist already, VPC Lattice creates it in your account. The service-linked role gives permissions to VPC Lattice so that it can call other AWS services on your behalf. For more information, see Using service-linked roles for Amazon VPC Lattice.
For automatic role creation to succeed, users must have permissions for the
iam:CreateServiceLinkedRole
action.
"Action": "iam:CreateServiceLinkedRole"
The following example demonstrates a policy that gives users with this policy permission to create a service-linked role for VPC Lattice.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iam:CreateServiceLinkedRole", "Resource": "arn:aws:iam::*:role/aws-service-role/vpc-lattice.amazonaws.com/AWSServiceRoleForVpcLattice", "Condition": { "StringLike": { "iam:AWSServiceName":"vpc-lattice.amazonaws.com" } } } ] }
For more information, see Service-linked role permissions in the IAM User Guide.