I'm trying to lock down a user to a specific `VPC` in `AWS` and following [How to Help Lock Down a User’s Amazon EC2 Capabilities to a Single VPC | AWS Security Blog](https://aws.amazon.com/blogs/security/how-to-help-lock-down-a-users-amazon-ec2-capabilities-to-a-single-vpc/).

It is mentioned that we need to create an `IAM role` with name `VPCLockDown` of type `AWS Service`

[![IAM role type](https://i.stack.imgur.com/dkvVl.png)](https://i.stack.imgur.com/dkvVl.png) 

and add the services for which the role needs access to. like `ec2`, `lambda` etc.

I was trying to create this role programatically using `boto3`.

I checked the [create\_role documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iam.html#IAM.Client.create_role) for creating a role using `boto3`.

However, they haven't mentioned anything to specify the type of role and the services that I can specify that the role should have access to.

Is there any way to specify these items while creation of the `IAM role` using `boto3`

**Edit1:**

I tried creating a service\_linked\_role as per **Sudarshan Rampuria**'s answer like 

```
response = iam.create_service_linked_role(
            AWSServiceName='ec2.amazonaws.com',
        )

```

But getting the following error:

> 
> An error occurred (AccessDenied) when calling the
>  CreateServiceLinkedRole operation: Cannot find Service Linked Role
>  template for ec2.amazonaws.com
> 
> 
>