Skip to main content

Lambda Role Permission and Trust Policy for Assume role

Example

Account:  1234567890

Role name: LambdaIAMRoleEC2Scanner

Lambda Function name: ec2ScannerNewNew


Questions:

why still error An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:sts::1234567890:assumed-role/LambdaIAMRoleEC2Scanner/ec2ScannerNewNew is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::1234567890:role/LambdaIAMRoleEC2Scanner I already put on lambda role with permission.


Answer:


Based on the error message you provided, it appears that the IAM user or role "arn:aws:sts::1234567890:assumed-role/LambdaIAMRoleEC2Scanner/ec2ScannerNewNew" does not have the necessary permissions to assume the role "arn:aws:iam::1234567890:role/LambdaIAMRoleEC2Scanner".

To resolve this issue, you need to ensure that the IAM user or role has the appropriate permissions to assume the role. Here are the steps you can take:

  1. Check the trust policy of the role "LambdaIAMRoleEC2Scanner":

    • Go to the IAM service in the AWS Management Console.
    • Navigate to the "Roles" section.
    • Find and select the "LambdaIAMRoleEC2Scanner" role.
    • Click on the "Trust relationships" tab.
    • Verify that the trust policy allows the IAM user or role "arn:aws:sts::1234567890:assumed-role/LambdaIAMRoleEC2Scanner/ec2ScannerNewNew" to assume this role.
  2. Check the permissions policy of the IAM user or role "arn:aws:sts::1234567890:assumed-role/LambdaIAMRoleEC2Scanner/ec2ScannerNewNew":

    • Go to the IAM service in the AWS Management Console.
    • Navigate to the "Users" or "Roles" section, depending on whether it is a user or a role.
    • Find and select the "arn:aws:sts::1234567890:assumed-role/LambdaIAMRoleEC2Scanner/ec2ScannerNewNew" user or role.
    • Click on the "Permissions" tab.
    • Ensure that the user or role has the necessary permissions to assume roles. Specifically, it should have the "sts:AssumeRole" permission on the resource "arn:aws:iam::1234567890:role/LambdaIAMRoleEC2Scanner".
  3. Update the policies if necessary:

    • If the trust policy or permissions policy is not correctly configured, you may need to update them.
    • Modify the policy document to include the necessary permissions or trust relationships.
    • Once updated, save the changes.

By ensuring that both the trust policy and permissions policy are properly configured, you should be able to resolve the "AccessDenied" error when calling the AssumeRole operation.



Trust policy

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com", "AWS": [ "arn:aws:sts::1234567890:federated-user/aws@bagussa.internet", "arn:aws:sts::1234567890:assumed-role/LambdaIAMRoleEC2Record/ec2ScannerNewNew" ] }, "Action": "sts:AssumeRole" } ] }


Assume role policy


{

    "Version": "2012-10-17",

    "Statement": [

        {

            "Sid": "VisualEditor0",

            "Effect": "Allow",

            "Action": "sts:AssumeRole",

            "Resource": [

                "arn:aws:iam::1234567890:role/LambdaIAMRoleEC2Record",

                "arn:aws:iam::1234567890:role/*"

            ]

        }

    ]

}


And then you can add another permission for checking EC2 scanner for use case tool, that is just use case, you can use another as well.

Comments

Popular posts from this blog

Soal dan pembahasan LKSN ITNSA

Berikut adalah koleksi soal-soal ITNSA dan beberapa website yang memberikan pembahasan pada event perlombaaan LKS SMK Nasional bidang lomba IT Network Systems Administration. 2014 Palembang Di tahun ini ada 1 soal packet tracer. Di website dibawah ini diberikan juga cara pembahasannya. https://agussas.wordpress.com/2015/04/02/review-soal-lks-nasional-it-network-23-packet-tracer-challenge/ Semua soal:  https://www.dropbox.com/sh/l90zyke2ib5msgv/AAA3kPOFo-zEn4wPOW4a3iMwa?dl=0 dan https://drive.google.com/file/d/18lDhtMjAnPAhkfOJ6uFHsC5j6ycg3K4I/view Pembahasan juga dalam bentuk video di youtube:  https://www.youtube.com/watch?v=8QML594nQBU 2015 Banten Pembahasan:   https://www.youtube.com/watch?v=quDbpC2xSfQ Soal:  https://drive.google.com/file/d/1B09IYfdoGENBL3txSQodpptG1zdQxBWI/view 2016 Malang Soal:   https://drive.google.com/file/d/13-2bRtb5IXO9vxAhLfhghZbDXeUzD0FI/view Pembahasan:   https://www.youtube.com/watch?v=zmUSUZguH24 20...

Dasar instalasi dan konfigurasi OpenLDAP

 ### Panduan Instalasi OpenLDAP Berikut adalah panduan sederhana untuk menginstal dan mengkonfigurasi OpenLDAP pada server dengan domain `bagussa.my.id` dan IP `10.10.10.1`.  #### 1. Instalasi OpenLDAP Pertama, instal OpenLDAP beserta paket-paket yang diperlukan: ```bash sudo apt update sudo apt install slapd ldap-utils ``` Selama instalasi, Anda mungkin akan diminta untuk memasukkan kata sandi untuk `admin` LDAP. Simpan kata sandi ini dengan aman. #### 2. Konfigurasi Manual di `/etc/hosts` Tambahkan entri untuk domain dan IP di file `/etc/hosts`: ```bash sudo nano /etc/hosts ``` Tambahkan baris berikut: ``` 10.10.10.1    bagussa.my.id ``` Simpan dan keluar dari editor. #### 3. Konfigurasi `/etc/ldap/ldap.conf` Edit file konfigurasi LDAP: ```bash sudo nano /etc/ldap/ldap.conf ``` Tambahkan atau modifikasi baris berikut: ``` BASE    dc=bagussa,dc=my,dc=id URI     ldap://10.10.10.1 ``` Simpan dan keluar dari editor. #### 4. Buat OU dan Group de...

Soal dan pembahasan LKS ITNSA Network Infrastructure Basic

Soal tahun 2021 tingkat Nasional Soal bisa di download di https://itnsa.id Basic Configuration Configure IP Address of all network devices according to the addressing table.  Create SSH user ‘patah’ with password specified in the appendix.  Make sure the user are able to enter configuration commands in the router.  Allow server admins to SSH to all network devices.  If you need to set additional password on the Routers, use Skills39 Look at the appendix table and configure accordingly Configure IP address: csr1000v# configure terminal #change interface name according to the topology csr1000v (config)# interface GigabitEthernet0 csr1000v (config-if)# ip address  x.x.x.x y.y.y.y csr1000v (config-if)# no shutdown Create SSH user: csr1000v# configure terminal csr1000v (config) # username patah password cisco123 csr1000v (config)# privilege 15 patah Allow server admins to SSH: csr1000v# configure terminal csr1000v (config)# ip access-list standard SSH_ACL csr10...