AWS ECR Connector
For AWS ECR you’ll need to create a connector to connect to your AWS account.
Create a Connector for AWS ECR Registry
- In the Container Security UI, go to Assets > Registries and click New Registry.
- Pick AWS ECR from the Registry Type menu.
- Choose a region from the Region menu. For an AWS GovCloud registry, you must pick one of the US GovCloud regions. You can choose "US East (GovCloud)" or "US West (GovCloud)". When you pick a US GovCloud region, you'll also need to select the US GovCloud account type in the connector details (see Step 6).
- Click Create New next to the Connector field.
You can delete misconfigured or unused connectors from the Connector list if they are not associated with any registries.
-
On the Connector Details page, give your connector a name, and provide a description.
- Choose the account type - Global or US GovCloud - that corresponds to the region you selected in Step 3.
- Select Global if you selected a standard AWS region.
- Select US GovCloud if you selected a US GovCloud region.
Your selection will determine the Qualys AWS Account ID and External ID that will be used.
- Take note of the Qualys AWS Account ID and External ID in the connector details for your subscription. Continue with the steps below to create a role for cross-account access using the connector details provided.
The steps you need also appear in the UI, on the right side of the Connector Details screen.
Create a Role for Cross-Account Access
- Log in to Amazon Web Services (AWS) Console.
- Go to the IAM service.
- Go to Roles and click Create Role.
- Under Select type of trusted entity, choose Another AWS account and
- Paste in the Qualys AWS Account ID (from connector details).
- Select Require external ID and paste in the External ID (from connector details).
- Click Next: Permissions.
- Find the policy titled “AmazonEC2ContainerRegistryReadOnly” and select the check box next to it. We recommend you use this default AWS policy. If you want to use a custom policy, see the "Using a Custom Policy?" section below.
- Enter a role name (e.g. CMS) and click Create role.
- Click on the role you just created to view details. Copy the Role ARN value and paste it into the connector details.
Using a Custom Policy?
To use a custom policy and to match all repositories that belong to a specific account, you can use a wildcard (*) when defining the Resource JSON policy element. See the proper formatting for the JSON below. Note that there are two statements defined inside the Statement element. Both statements must be present. You’ll also need to replace the region and account number (shown in bold red) with appropriate values.
Define your policy first and then follow the steps outlined above to create a role for cross-account access using the Qualys AWS Account ID and External ID from the connector details in the Container Security UI. In Step 5, pick your custom policy instead of “AmazonEC2ContainerRegistryReadOnly”.
After creating the custom policy, finish the role creation with step 6 and 7.
Policy JSON:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement1",
"Effect": "Allow",
"Action": [
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:DescribeImages",
"ecr:ListImages",
"ecr:GetRepositoryPolicy"
],
"Resource": "arn:aws:ecr:us-west-1:123456789012:repository/*"
},
{
"Sid": "Statement2",
"Effect": "Allow",
"Action": [
"ecr:DescribeRepositories",
"ecr:GetAuthorizationToken"
],
"Resource": "*"
}
]
}