Delegating external parties access to AWS

May 14, 2021 – Samuli Seppänen

This blog post shows how to grant access to an AWS account for some external party. For simplicity we will call this external party a "contractor". If you want to do the same for Microsoft Azure look at this blog post instead.

This method requires the contractor to have its own AWS account, but it has several benefits:

  • No need to create AWS user accounts for every single person working for the contractor
  • You can force the contractor's personnel to use two-factor authentication (2FA)
  • You can force the contractor to use an additional password (shared secret)
  • You can disable contractor's access completely by just removing the IAM role

This approach works equally well for AWS Console access, AWS CLI and tools like Terraform. Some tools may not like the extra security measures required here or be able to assume a role out of the box.

In the example below we show how to grant read-only permissions to whole of AWS, which is useful for things like auditing, documentation and modeling infrastructure. But what the contractor can do depends entirely on what permissions you grant to the IAM role you create.

Adding a role to AWS

The first step is to add a role with ReadOnlyAccess to your AWS account. The role can then be assumed by the contractor. To do this login to AWS console:

Search for “iam” and then select the IAM service from the list:

Click on “Access management” → “Roles”:

Click “Create role”:

Select “Another AWS Account” as the trusted entity:

Set “Account ID” to match the contractor's AWS account ID. Add an “External ID” (~password) and check “Require MFA”. Click “Next: Permissions”:

Check the “ReadOnlyAccess” or some other suitable policy from your IAM policy list. Click “Next: Tags”:

Optional: add tags to the role. Click “Next: Review”:

Give the role a name. Here we optimistically use our name “puppeteers”. Add description if you want. Click “Create role”:

On the role list click on the role you created (here: “puppeteers”):

Click on the “Trust relationships” tab:

Mark down “Role ARN” and “sts:ExternalId”:

The last and final step is to send std:ExternalID and RoleARN to the contractor. Then the contractor's employees can assume the role you created for them, provided they have two-factor authentication turned on in their AWS account.

Want to talk to an expert?

If you want to reach us, just send us a message or book a free call!
Categories

Tags

#aad #Access #acl #alertmanager #ansible #ansible module development #Apache #API #augeas #authentication #authorization #automation #automatization #aws #azure #backup #bash #bitbucket #buildbot #cache #centos #cloud #cloud-init #cloudflare #cloudfront #cluster #connectionsJpa #control repo #custom fact #database #debian #devops #digital sovereignty #DNS #docker #domain mode #duplo #ejabberd #email #encryption #erb #europe #eyaml #fabric #facter #facts #fargate #fedora #file #finnish #foreman #freeipa #git #github #gitlab #gnome #google #grafana #hammer #hiera #IAM #import #infinispan #Infrastructure as Code #ipmi #irc #jboss #jdk #jenkins #JMESPath #kanban #keycloak #librarian-puppet #librenms #linkedin #Linux #Location #loop #marketing #mautic #Mellon #mfa #monitoring #mysql #nagios #network-manager #oauth #oauth2 #office365 #open source #openvpn #oxygen #packer #paranormal #pdk #people #php #pkcs7 #pomodoro #Powershell #preseed #presentation #profiles #prometheus #provisioning #puppet #puppet-bolt #puppet-litmus #puppetboard #puppetdb #Puppetfile #puppetserver #puppet types and providers #pxeboot #qemu #quality #r10k #recruitment #redirect #Restrict #Reverse Proxy #roles #rspec #ruby #SAML #sem #shell #showsql #snmp #snmpd #software developement #spam #ssh #sso #standardization #systemd #systemd-resolved #teams #terraform #ubuntu #user-data #vagrant #vanity awards #variable #vim #virtualbox #visualstudio #webdevelopment #wildfly #Windows #wireguard #wordpress #workflow #x11 #xmpp #zimbra
We are
 Puppeteers
menucross-circle