Camel Components

AWS Identity and Access Management (IAM)

Since Camel 3.1

Only producer is supported

The AWS2 IAM component supports create, run, start, stop and terminate AWS IAM instances.

Prerequisites

You must have a valid Amazon Web Services developer account, and be signed up to use Amazon IAM. More information is available at Amazon IAM.

URI Format

aws2-iam://label[?options]

You can append query options to the URI in the following format:

?options=value&option2=value&…​

The AWS2 IAM component works on the aws-global region, and it has aws-global as the default region

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.

For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.

Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.

You can configure components using:

  • the Component DSL.

  • in a configuration file (application.properties, *.yaml files, etc).

  • directly in the Java code.

Configuring Endpoint Options

You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.

Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.

A good practice when configuring options is to use Property Placeholders.

Property placeholders provide a few benefits:

  • They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.

  • They allow externalizing the configuration from the code.

  • They help the code to become more flexible and reusable.

The following two sections list all the options, firstly for the component followed by the endpoint.

Component Options

The AWS Identity and Access Management (IAM) component supports the following options which are listed below.

Name Description Default Type

configuration (producer)

The configuration that the endpoints of the component start from. Each endpoint uses a copy of it, in which its own URI options replace the values.

IAM2Configuration

iamClient (producer)

Autowired To use a custom software.amazon.awssdk.services.iam.IamClient. When this option is set or autowired, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used to build a client. The Camel endpoint does not close a client that is set or autowired.

IamClient

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

operation (producer)

The operation that the producer performs. The CamelAwsIAMOperation header replaces this option. If neither is set, the exchange fails.

Enum values:

  • listAccessKeys

  • createUser

  • deleteUser

  • getUser

  • listUsers

  • createAccessKey

  • deleteAccessKey

  • updateAccessKey

  • createGroup

  • deleteGroup

  • listGroups

  • addUserToGroup

  • removeUserFromGroup

  • createRole

  • deleteRole

  • getRole

  • listRoles

  • createPolicy

  • deletePolicy

  • getPolicy

  • listPolicies

  • attachUserPolicy

  • detachUserPolicy

  • attachGroupPolicy

  • detachGroupPolicy

  • attachRolePolicy

  • detachRolePolicy

  • createInstanceProfile

  • deleteInstanceProfile

  • getInstanceProfile

  • listInstanceProfiles

  • addRoleToInstanceProfile

  • removeRoleFromInstanceProfile

IAM2Operations

overrideEndpoint (producer)

Whether to send the requests to the URI of the uriEndpointOverride option instead of the endpoint of the region. It has no effect when uriEndpointOverride is not set.

false

boolean

pojoRequest (producer)

Whether the body is the request object of the AWS SDK for the operation, such as a CreateUserRequest, which the producer sends as it is. The headers that give the input of the operation are then not used, and an empty body or a body of another type fails the exchange.

false

boolean

region (producer)

The AWS region of the IAM client, as a region ID such as aws-global, which is the value of Region.AWS_GLOBAL.id(). IAM is a global service: the default aws-global is for the standard AWS partition, and aws-cn-global and aws-us-gov-global are for the China and AWS GovCloud (US) partitions.

Enum values:

  • ap-south-2

  • ap-south-1

  • eu-south-1

  • eu-south-2

  • us-gov-east-1

  • me-central-1

  • il-central-1

  • ca-central-1

  • eu-central-1

  • us-iso-west-1

  • eu-central-2

  • us-west-1

  • us-west-2

  • af-south-1

  • eu-north-1

  • eu-west-3

  • eu-west-2

  • eu-west-1

  • ap-northeast-3

  • ap-northeast-2

  • ap-northeast-1

  • me-south-1

  • sa-east-1

  • ap-east-1

  • cn-north-1

  • us-gov-west-1

  • ap-southeast-1

  • ap-southeast-2

  • us-iso-east-1

  • ap-southeast-3

  • ap-southeast-4

  • us-east-1

  • us-east-2

  • cn-northwest-1

  • us-isob-east-1

  • aws-global

  • aws-cn-global

  • aws-us-gov-global

  • aws-iso-global

  • aws-iso-b-global

aws-global

String

uriEndpointOverride (producer)

The URI of the endpoint to use instead of the endpoint of the region, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

autowiredEnabled (advanced)

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

boolean

healthCheckConsumerEnabled (health)

Used for enabling or disabling all consumer based health checks from this component.

true

boolean

healthCheckProducerEnabled (health)

Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true.

true

boolean

proxyHost (proxy)

The host name of the proxy that the HTTP client of IAM connects through. The proxy is used only when the proxyPort option is set too.

String

proxyPort (proxy)

The port of the proxy that the HTTP client of IAM connects through. The proxy is used only when the proxyHost option is set too.

Integer

proxyProtocol (proxy)

The protocol that the HTTP client of IAM uses to connect to the proxy. It is used only when the proxyHost and proxyPort options are set.

Enum values:

  • HTTP

  • HTTPS

HTTPS

Protocol

accessKey (security)

The access key ID of the AWS credentials, used together with the secretKey option. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

String

profileCredentialsName (security)

The name of the profile in the AWS shared credentials and config files, used when useProfileCredentialsProvider is true. If not set, the AWS SDK uses its default profile, which the AWS_PROFILE environment variable can change.

String

secretKey (security)

The secret access key of the AWS credentials, used together with the accessKey option. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

String

sessionToken (security)

The session token of temporary AWS credentials, for example of an assumed IAM role. It is used only when useSessionCredentials is true, together with the accessKey and secretKey options.

String

trustAllCertificates (security)

Whether the HTTP client of IAM trusts every TLS certificate without checking it. It applies to any endpoint, not only to an overridden one, so use it only for testing, for example against a local emulator.

false

boolean

useDefaultCredentialsProvider (security)

Whether to load the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the shared credentials and config files, and the container or instance role. It takes precedence over the other credentials options.

false

boolean

useProfileCredentialsProvider (security)

Whether to load the credentials from a profile of the AWS shared credentials and config files, the one of the profileCredentialsName option. It is not used when useDefaultCredentialsProvider is true, and it takes precedence over the session and static credentials.

false

boolean

useSessionCredentials (security)

Whether to use temporary credentials made of the accessKey, secretKey and sessionToken options, for example those of an assumed IAM role. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

false

boolean

Endpoint Options

The AWS Identity and Access Management (IAM) endpoint is configured using URI syntax:

aws2-iam:label

With the following path and query parameters:

Path Parameters

Name Description Default Type

label (producer)

Required A logical name of your choice for the endpoint. The producer does not send it to IAM.

String

Query Parameters

Name Description Default Type

iamClient (producer)

Autowired To use a custom software.amazon.awssdk.services.iam.IamClient. When this option is set or autowired, the credentials, region, proxy, endpoint override and trustAllCertificates options are not used to build a client. The Camel endpoint does not close a client that is set or autowired.

IamClient

operation (producer)

The operation that the producer performs. The CamelAwsIAMOperation header replaces this option. If neither is set, the exchange fails.

Enum values:

  • listAccessKeys

  • createUser

  • deleteUser

  • getUser

  • listUsers

  • createAccessKey

  • deleteAccessKey

  • updateAccessKey

  • createGroup

  • deleteGroup

  • listGroups

  • addUserToGroup

  • removeUserFromGroup

  • createRole

  • deleteRole

  • getRole

  • listRoles

  • createPolicy

  • deletePolicy

  • getPolicy

  • listPolicies

  • attachUserPolicy

  • detachUserPolicy

  • attachGroupPolicy

  • detachGroupPolicy

  • attachRolePolicy

  • detachRolePolicy

  • createInstanceProfile

  • deleteInstanceProfile

  • getInstanceProfile

  • listInstanceProfiles

  • addRoleToInstanceProfile

  • removeRoleFromInstanceProfile

IAM2Operations

overrideEndpoint (producer)

Whether to send the requests to the URI of the uriEndpointOverride option instead of the endpoint of the region. It has no effect when uriEndpointOverride is not set.

false

boolean

pojoRequest (producer)

Whether the body is the request object of the AWS SDK for the operation, such as a CreateUserRequest, which the producer sends as it is. The headers that give the input of the operation are then not used, and an empty body or a body of another type fails the exchange.

false

boolean

region (producer)

The AWS region of the IAM client, as a region ID such as aws-global, which is the value of Region.AWS_GLOBAL.id(). IAM is a global service: the default aws-global is for the standard AWS partition, and aws-cn-global and aws-us-gov-global are for the China and AWS GovCloud (US) partitions.

Enum values:

  • ap-south-2

  • ap-south-1

  • eu-south-1

  • eu-south-2

  • us-gov-east-1

  • me-central-1

  • il-central-1

  • ca-central-1

  • eu-central-1

  • us-iso-west-1

  • eu-central-2

  • us-west-1

  • us-west-2

  • af-south-1

  • eu-north-1

  • eu-west-3

  • eu-west-2

  • eu-west-1

  • ap-northeast-3

  • ap-northeast-2

  • ap-northeast-1

  • me-south-1

  • sa-east-1

  • ap-east-1

  • cn-north-1

  • us-gov-west-1

  • ap-southeast-1

  • ap-southeast-2

  • us-iso-east-1

  • ap-southeast-3

  • ap-southeast-4

  • us-east-1

  • us-east-2

  • cn-northwest-1

  • us-isob-east-1

  • aws-global

  • aws-cn-global

  • aws-us-gov-global

  • aws-iso-global

  • aws-iso-b-global

aws-global

String

uriEndpointOverride (producer)

The URI of the endpoint to use instead of the endpoint of the region, for example http://localhost:4566 for a local emulator. It is used only when overrideEndpoint is true.

String

lazyStartProducer (producer (advanced))

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

boolean

proxyHost (proxy)

The host name of the proxy that the HTTP client of IAM connects through. The proxy is used only when the proxyPort option is set too.

String

proxyPort (proxy)

The port of the proxy that the HTTP client of IAM connects through. The proxy is used only when the proxyHost option is set too.

Integer

proxyProtocol (proxy)

The protocol that the HTTP client of IAM uses to connect to the proxy. It is used only when the proxyHost and proxyPort options are set.

Enum values:

  • HTTP

  • HTTPS

HTTPS

Protocol

accessKey (security)

The access key ID of the AWS credentials, used together with the secretKey option. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

String

profileCredentialsName (security)

The name of the profile in the AWS shared credentials and config files, used when useProfileCredentialsProvider is true. If not set, the AWS SDK uses its default profile, which the AWS_PROFILE environment variable can change.

String

secretKey (security)

The secret access key of the AWS credentials, used together with the accessKey option. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

String

sessionToken (security)

The session token of temporary AWS credentials, for example of an assumed IAM role. It is used only when useSessionCredentials is true, together with the accessKey and secretKey options.

String

trustAllCertificates (security)

Whether the HTTP client of IAM trusts every TLS certificate without checking it. It applies to any endpoint, not only to an overridden one, so use it only for testing, for example against a local emulator.

false

boolean

useDefaultCredentialsProvider (security)

Whether to load the credentials with the default credentials provider chain of the AWS SDK, which looks in system properties, environment variables, the shared credentials and config files, and the container or instance role. It takes precedence over the other credentials options.

false

boolean

useProfileCredentialsProvider (security)

Whether to load the credentials from a profile of the AWS shared credentials and config files, the one of the profileCredentialsName option. It is not used when useDefaultCredentialsProvider is true, and it takes precedence over the session and static credentials.

false

boolean

useSessionCredentials (security)

Whether to use temporary credentials made of the accessKey, secretKey and sessionToken options, for example those of an assumed IAM role. It is not used when useDefaultCredentialsProvider or useProfileCredentialsProvider is true.

false

boolean

Message Headers

The AWS Identity and Access Management (IAM) component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelAwsIAMOperation (producer)

Constant: OPERATION

The operation that the producer performs. It replaces the operation option.

String

CamelAwsIAMUsername (producer)

Constant: USERNAME

The name of the IAM user. createUser, deleteUser, getUser, addUserToGroup, removeUserFromGroup, attachUserPolicy and detachUserPolicy require it. listAccessKeys, createAccessKey, deleteAccessKey and updateAccessKey use it to select the user of the access key; when not set, IAM takes the user of the access key that signs the request.

String

CamelAwsIAMAccessKeyID (producer)

Constant: ACCESS_KEY_ID

The ID of the access key that deleteAccessKey deletes or updateAccessKey updates. Both operations require it.

String

CamelAwsIAMAccessKeyStatus (producer)

Constant: ACCESS_KEY_STATUS

The status that updateAccessKey sets on the access key: Active or Inactive, in any case. updateAccessKey requires it, and another value fails the exchange.

String

CamelAwsIAMGroupName (producer)

Constant: GROUP_NAME

The name of the IAM group. createGroup, deleteGroup, addUserToGroup, removeUserFromGroup, attachGroupPolicy and detachGroupPolicy require it.

String

CamelAwsIAMGroupPath (producer)

Constant: GROUP_PATH

The path of the group that createGroup creates, such as /division_abc/. When not set, IAM uses the path /.

String

CamelAwsIAMMarker (producer)

Constant: MARKER

The marker of the CamelAwsIAMNextMarker header of the previous response, to get the next page of results of a list operation: listAccessKeys, listUsers, listGroups, listRoles, listPolicies or listInstanceProfiles.

String

CamelAwsIAMMaxItems (producer)

Constant: MAX_ITEMS

The maximum number of items in one page of results of a list operation: listAccessKeys, listUsers, listGroups, listRoles, listPolicies or listInstanceProfiles. IAM accepts 1 to 1000, and returns at most 100 items when not set.

Integer

CamelAwsIAMIsTruncated (producer)

Constant: IS_TRUNCATED

Whether a list operation has more results than it returned. When true, the CamelAwsIAMNextMarker header gives the marker of the next page.

Boolean

CamelAwsIAMNextMarker (producer)

Constant: NEXT_MARKER

The marker that a list operation sets when it has more results. Send it in the CamelAwsIAMMarker header to get the next page.

String

CamelAwsIAMUserArn (producer)

Constant: USER_ARN

The ARN of the user that createUser created or getUser returned.

String

CamelAwsIAMUserId (producer)

Constant: USER_ID

The unique ID that IAM gave to the user that createUser created or getUser returned.

String

CamelAwsIAMGroupArn (producer)

Constant: GROUP_ARN

The ARN of the group that createGroup created.

String

CamelAwsIAMGroupId (producer)

Constant: GROUP_ID

The unique ID that IAM gave to the group that createGroup created.

String

CamelAwsIAMRoleName (producer)

Constant: ROLE_NAME

The name of the IAM role. createRole, deleteRole, getRole, attachRolePolicy, detachRolePolicy, addRoleToInstanceProfile and removeRoleFromInstanceProfile require it.

String

CamelAwsIAMRolePath (producer)

Constant: ROLE_PATH

The path of the role that createRole creates. When not set, IAM uses the path /.

String

CamelAwsIAMAssumeRolePolicyDocument (producer)

Constant: ASSUME_ROLE_POLICY_DOCUMENT

The trust policy of the role that createRole creates, as a JSON policy document that says which principals can assume the role. createRole requires it.

String

CamelAwsIAMRoleArn (producer)

Constant: ROLE_ARN

The ARN of the role that createRole created or getRole returned.

String

CamelAwsIAMRoleId (producer)

Constant: ROLE_ID

The unique ID that IAM gave to the role that createRole created or getRole returned.

String

CamelAwsIAMRoleDescription (producer)

Constant: ROLE_DESCRIPTION

The description of the role that createRole creates.

String

CamelAwsIAMPolicyName (producer)

Constant: POLICY_NAME

The name of the managed policy that createPolicy creates. createPolicy requires it.

String

CamelAwsIAMPolicyPath (producer)

Constant: POLICY_PATH

The path of the managed policy that createPolicy creates. When not set, IAM uses the path /.

String

CamelAwsIAMPolicyDocument (producer)

Constant: POLICY_DOCUMENT

The JSON policy document of the managed policy that createPolicy creates, with the permissions of the policy. createPolicy requires it.

String

CamelAwsIAMPolicyArn (producer)

Constant: POLICY_ARN

The ARN of the managed policy. deletePolicy, getPolicy and the operations that attach a policy to or detach it from a user, group or role require it. createPolicy and getPolicy set it to the ARN of the created or returned policy.

String

CamelAwsIAMPolicyId (producer)

Constant: POLICY_ID

The unique ID that IAM gave to the managed policy that createPolicy created or getPolicy returned.

String

CamelAwsIAMPolicyDescription (producer)

Constant: POLICY_DESCRIPTION

The description of the managed policy that createPolicy creates.

String

CamelAwsIAMInstanceProfileName (producer)

Constant: INSTANCE_PROFILE_NAME

The name of the instance profile. createInstanceProfile, deleteInstanceProfile, getInstanceProfile, addRoleToInstanceProfile and removeRoleFromInstanceProfile require it.

String

CamelAwsIAMInstanceProfilePath (producer)

Constant: INSTANCE_PROFILE_PATH

The path of the instance profile that createInstanceProfile creates. When not set, IAM uses the path /.

String

CamelAwsIAMInstanceProfileArn (producer)

Constant: INSTANCE_PROFILE_ARN

The ARN of the instance profile that createInstanceProfile created or getInstanceProfile returned.

String

CamelAwsIAMInstanceProfileId (producer)

Constant: INSTANCE_PROFILE_ID

The unique ID that IAM gave to the instance profile that createInstanceProfile created or getInstanceProfile returned.

String

Message Body

The message body at each side of the AWS Identity and Access Management (IAM) component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.

Side Body Description

Producer input

any

Not used: the names, the ARNs and the policy documents come from headers, such as CamelAwsIAMUsername. With pojoRequest=true the request of the AWS SDK for the operation, such as a CreateUserRequest: another body fails.

  • With pojoRequest=true: pojo

Producer output

pojo

The response of the AWS SDK for the operation, such as the CreateUserResponse of createUser; the create and get operations put the ARN and the id in headers too.

The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.

Required IAM component options

You have to provide the amazonKmsClient in the Registry or your accessKey and secretKey to access the Amazon IAM service.

Usage

Static credentials, Default Credential Provider and Profile Credentials Provider

You have the possibility of avoiding the usage of explicit static credentials by specifying the useDefaultCredentialsProvider option and set it to true.

The order of evaluation for Default Credentials Provider is the following:

  • Java system properties - aws.accessKeyId and aws.secretKey.

  • Environment variables - AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

  • Web Identity Token from AWS STS.

  • The shared credentials and config files.

  • Amazon ECS container credentials - loaded from the Amazon ECS if the environment variable AWS_CONTAINER_CREDENTIALS_RELATIVE_URI is set.

  • Amazon EC2 Instance profile credentials.

You have also the possibility of using Profile Credentials Provider, by specifying the useProfileCredentialsProvider option to true and profileCredentialsName to the profile name.

Only one of static, default and profile credentials could be used at the same time.

For more information about this you can look at AWS credentials documentation

IAM Producer operations

Camel-AWS2 IAM component provides the following operation on the producer side:

  • listAccessKeys

  • createUser

  • deleteUser

  • listUsers

  • getUser

  • createAccessKey

  • deleteAccessKey

  • updateAccessKey

  • createGroup

  • deleteGroup

  • listGroups

  • addUserToGroup

  • removeUserFromGroup

  • createRole

  • deleteRole

  • getRole

  • listRoles

  • createPolicy

  • deletePolicy

  • getPolicy

  • listPolicies

  • attachUserPolicy

  • detachUserPolicy

  • attachGroupPolicy

  • detachGroupPolicy

  • attachRolePolicy

  • detachRolePolicy

  • createInstanceProfile

  • deleteInstanceProfile

  • getInstanceProfile

  • listInstanceProfiles

  • addRoleToInstanceProfile

  • removeRoleFromInstanceProfile

Examples

Producer Examples

  • createUser: this operation will create a user in IAM

  • Java

  • XML

  • YAML

from("direct:createUser")
    .setHeader("CamelAwsIAMUsername", constant("camel"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=createUser");
<route>
    <from uri="direct:createUser"/>
    <setHeader name="CamelAwsIAMUsername">
        <constant>camel</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=createUser"/>
</route>
- route:
    from:
      uri: direct:createUser
      steps:
        - setHeader:
            name: CamelAwsIAMUsername
            constant: camel
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: createUser
  • deleteUser: this operation will delete a user in IAM

  • Java

  • XML

  • YAML

from("direct:deleteUser")
    .setHeader("CamelAwsIAMUsername", constant("camel"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=deleteUser");
<route>
    <from uri="direct:deleteUser"/>
    <setHeader name="CamelAwsIAMUsername">
        <constant>camel</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=deleteUser"/>
</route>
- route:
    from:
      uri: direct:deleteUser
      steps:
        - setHeader:
            name: CamelAwsIAMUsername
            constant: camel
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: deleteUser
  • listUsers: this operation will list the users in IAM

  • Java

  • XML

  • YAML

from("direct:listUsers")
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=listUsers");
<route>
    <from uri="direct:listUsers"/>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=listUsers"/>
</route>
- route:
    from:
      uri: direct:listUsers
      steps:
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: listUsers
  • createGroup: this operation will add a group in IAM

  • Java

  • XML

  • YAML

from("direct:createGroup")
    .setHeader("CamelAwsIAMGroupName", constant("camel"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=createGroup");
<route>
    <from uri="direct:createGroup"/>
    <setHeader name="CamelAwsIAMGroupName">
        <constant>camel</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=createGroup"/>
</route>
- route:
    from:
      uri: direct:createGroup
      steps:
        - setHeader:
            name: CamelAwsIAMGroupName
            constant: camel
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: createGroup
  • deleteGroup: this operation will delete a group in IAM

  • Java

  • XML

  • YAML

from("direct:deleteGroup")
    .setHeader("CamelAwsIAMGroupName", constant("camel"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=deleteGroup");
<route>
    <from uri="direct:deleteGroup"/>
    <setHeader name="CamelAwsIAMGroupName">
        <constant>camel</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=deleteGroup"/>
</route>
- route:
    from:
      uri: direct:deleteGroup
      steps:
        - setHeader:
            name: CamelAwsIAMGroupName
            constant: camel
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: deleteGroup
  • listGroups: this operation will list the groups in IAM

  • Java

  • XML

  • YAML

from("direct:listGroups")
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=listGroups");
<route>
    <from uri="direct:listGroups"/>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=listGroups"/>
</route>
- route:
    from:
      uri: direct:listGroups
      steps:
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: listGroups

Role Operations

  • createRole: this operation will create a role in IAM

  • Java

  • XML

  • YAML

from("direct:createRole")
    .setHeader("CamelAwsIAMRoleName", constant("myRole"))
    .setHeader("CamelAwsIAMAssumeRolePolicyDocument", constant("{...}"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=createRole");
<route>
    <from uri="direct:createRole"/>
    <setHeader name="CamelAwsIAMRoleName">
        <constant>myRole</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMAssumeRolePolicyDocument">
        <constant>{...}</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=createRole"/>
</route>
- route:
    from:
      uri: direct:createRole
      steps:
        - setHeader:
            name: CamelAwsIAMRoleName
            constant: myRole
        - setHeader:
            name: CamelAwsIAMAssumeRolePolicyDocument
            constant: "{...}"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: createRole
  • deleteRole: this operation will delete a role in IAM

  • Java

  • XML

  • YAML

from("direct:deleteRole")
    .setHeader("CamelAwsIAMRoleName", constant("myRole"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=deleteRole");
<route>
    <from uri="direct:deleteRole"/>
    <setHeader name="CamelAwsIAMRoleName">
        <constant>myRole</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=deleteRole"/>
</route>
- route:
    from:
      uri: direct:deleteRole
      steps:
        - setHeader:
            name: CamelAwsIAMRoleName
            constant: myRole
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: deleteRole
  • getRole: this operation will get a role in IAM

  • Java

  • XML

  • YAML

from("direct:getRole")
    .setHeader("CamelAwsIAMRoleName", constant("myRole"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=getRole");
<route>
    <from uri="direct:getRole"/>
    <setHeader name="CamelAwsIAMRoleName">
        <constant>myRole</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=getRole"/>
</route>
- route:
    from:
      uri: direct:getRole
      steps:
        - setHeader:
            name: CamelAwsIAMRoleName
            constant: myRole
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: getRole
  • listRoles: this operation will list the roles in IAM

  • Java

  • XML

  • YAML

from("direct:listRoles")
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=listRoles");
<route>
    <from uri="direct:listRoles"/>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=listRoles"/>
</route>
- route:
    from:
      uri: direct:listRoles
      steps:
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: listRoles

Policy Operations

  • createPolicy: this operation will create a policy in IAM

  • Java

  • XML

  • YAML

from("direct:createPolicy")
    .setHeader("CamelAwsIAMPolicyName", constant("myPolicy"))
    .setHeader("CamelAwsIAMPolicyDocument", constant("{...}"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=createPolicy");
<route>
    <from uri="direct:createPolicy"/>
    <setHeader name="CamelAwsIAMPolicyName">
        <constant>myPolicy</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMPolicyDocument">
        <constant>{...}</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=createPolicy"/>
</route>
- route:
    from:
      uri: direct:createPolicy
      steps:
        - setHeader:
            name: CamelAwsIAMPolicyName
            constant: myPolicy
        - setHeader:
            name: CamelAwsIAMPolicyDocument
            constant: "{...}"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: createPolicy
  • deletePolicy: this operation will delete a policy in IAM

  • Java

  • XML

  • YAML

from("direct:deletePolicy")
    .setHeader("CamelAwsIAMPolicyArn", constant("arn:aws:iam::123456789012:policy/myPolicy"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=deletePolicy");
<route>
    <from uri="direct:deletePolicy"/>
    <setHeader name="CamelAwsIAMPolicyArn">
        <constant>arn:aws:iam::123456789012:policy/myPolicy</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=deletePolicy"/>
</route>
- route:
    from:
      uri: direct:deletePolicy
      steps:
        - setHeader:
            name: CamelAwsIAMPolicyArn
            constant: "arn:aws:iam::123456789012:policy/myPolicy"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: deletePolicy
  • getPolicy: this operation will get a policy in IAM

  • Java

  • XML

  • YAML

from("direct:getPolicy")
    .setHeader("CamelAwsIAMPolicyArn", constant("arn:aws:iam::123456789012:policy/myPolicy"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=getPolicy");
<route>
    <from uri="direct:getPolicy"/>
    <setHeader name="CamelAwsIAMPolicyArn">
        <constant>arn:aws:iam::123456789012:policy/myPolicy</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=getPolicy"/>
</route>
- route:
    from:
      uri: direct:getPolicy
      steps:
        - setHeader:
            name: CamelAwsIAMPolicyArn
            constant: "arn:aws:iam::123456789012:policy/myPolicy"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: getPolicy
  • listPolicies: this operation will list the policies in IAM

  • Java

  • XML

  • YAML

from("direct:listPolicies")
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=listPolicies");
<route>
    <from uri="direct:listPolicies"/>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=listPolicies"/>
</route>
- route:
    from:
      uri: direct:listPolicies
      steps:
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: listPolicies

Policy Attachment Operations

  • attachUserPolicy: this operation will attach a policy to a user

  • Java

  • XML

  • YAML

from("direct:attachUserPolicy")
    .setHeader("CamelAwsIAMUsername", constant("camel"))
    .setHeader("CamelAwsIAMPolicyArn", constant("arn:aws:iam::123456789012:policy/myPolicy"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=attachUserPolicy");
<route>
    <from uri="direct:attachUserPolicy"/>
    <setHeader name="CamelAwsIAMUsername">
        <constant>camel</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMPolicyArn">
        <constant>arn:aws:iam::123456789012:policy/myPolicy</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=attachUserPolicy"/>
</route>
- route:
    from:
      uri: direct:attachUserPolicy
      steps:
        - setHeader:
            name: CamelAwsIAMUsername
            constant: camel
        - setHeader:
            name: CamelAwsIAMPolicyArn
            constant: "arn:aws:iam::123456789012:policy/myPolicy"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: attachUserPolicy
  • detachUserPolicy: this operation will detach a policy from a user

  • Java

  • XML

  • YAML

from("direct:detachUserPolicy")
    .setHeader("CamelAwsIAMUsername", constant("camel"))
    .setHeader("CamelAwsIAMPolicyArn", constant("arn:aws:iam::123456789012:policy/myPolicy"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=detachUserPolicy");
<route>
    <from uri="direct:detachUserPolicy"/>
    <setHeader name="CamelAwsIAMUsername">
        <constant>camel</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMPolicyArn">
        <constant>arn:aws:iam::123456789012:policy/myPolicy</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=detachUserPolicy"/>
</route>
- route:
    from:
      uri: direct:detachUserPolicy
      steps:
        - setHeader:
            name: CamelAwsIAMUsername
            constant: camel
        - setHeader:
            name: CamelAwsIAMPolicyArn
            constant: "arn:aws:iam::123456789012:policy/myPolicy"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: detachUserPolicy
  • attachGroupPolicy: this operation will attach a policy to a group

  • Java

  • XML

  • YAML

from("direct:attachGroupPolicy")
    .setHeader("CamelAwsIAMGroupName", constant("myGroup"))
    .setHeader("CamelAwsIAMPolicyArn", constant("arn:aws:iam::123456789012:policy/myPolicy"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=attachGroupPolicy");
<route>
    <from uri="direct:attachGroupPolicy"/>
    <setHeader name="CamelAwsIAMGroupName">
        <constant>myGroup</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMPolicyArn">
        <constant>arn:aws:iam::123456789012:policy/myPolicy</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=attachGroupPolicy"/>
</route>
- route:
    from:
      uri: direct:attachGroupPolicy
      steps:
        - setHeader:
            name: CamelAwsIAMGroupName
            constant: myGroup
        - setHeader:
            name: CamelAwsIAMPolicyArn
            constant: "arn:aws:iam::123456789012:policy/myPolicy"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: attachGroupPolicy
  • detachGroupPolicy: this operation will detach a policy from a group

  • Java

  • XML

  • YAML

from("direct:detachGroupPolicy")
    .setHeader("CamelAwsIAMGroupName", constant("myGroup"))
    .setHeader("CamelAwsIAMPolicyArn", constant("arn:aws:iam::123456789012:policy/myPolicy"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=detachGroupPolicy");
<route>
    <from uri="direct:detachGroupPolicy"/>
    <setHeader name="CamelAwsIAMGroupName">
        <constant>myGroup</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMPolicyArn">
        <constant>arn:aws:iam::123456789012:policy/myPolicy</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=detachGroupPolicy"/>
</route>
- route:
    from:
      uri: direct:detachGroupPolicy
      steps:
        - setHeader:
            name: CamelAwsIAMGroupName
            constant: myGroup
        - setHeader:
            name: CamelAwsIAMPolicyArn
            constant: "arn:aws:iam::123456789012:policy/myPolicy"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: detachGroupPolicy
  • attachRolePolicy: this operation will attach a policy to a role

  • Java

  • XML

  • YAML

from("direct:attachRolePolicy")
    .setHeader("CamelAwsIAMRoleName", constant("myRole"))
    .setHeader("CamelAwsIAMPolicyArn", constant("arn:aws:iam::123456789012:policy/myPolicy"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=attachRolePolicy");
<route>
    <from uri="direct:attachRolePolicy"/>
    <setHeader name="CamelAwsIAMRoleName">
        <constant>myRole</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMPolicyArn">
        <constant>arn:aws:iam::123456789012:policy/myPolicy</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=attachRolePolicy"/>
</route>
- route:
    from:
      uri: direct:attachRolePolicy
      steps:
        - setHeader:
            name: CamelAwsIAMRoleName
            constant: myRole
        - setHeader:
            name: CamelAwsIAMPolicyArn
            constant: "arn:aws:iam::123456789012:policy/myPolicy"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: attachRolePolicy
  • detachRolePolicy: this operation will detach a policy from a role

  • Java

  • XML

  • YAML

from("direct:detachRolePolicy")
    .setHeader("CamelAwsIAMRoleName", constant("myRole"))
    .setHeader("CamelAwsIAMPolicyArn", constant("arn:aws:iam::123456789012:policy/myPolicy"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=detachRolePolicy");
<route>
    <from uri="direct:detachRolePolicy"/>
    <setHeader name="CamelAwsIAMRoleName">
        <constant>myRole</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMPolicyArn">
        <constant>arn:aws:iam::123456789012:policy/myPolicy</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=detachRolePolicy"/>
</route>
- route:
    from:
      uri: direct:detachRolePolicy
      steps:
        - setHeader:
            name: CamelAwsIAMRoleName
            constant: myRole
        - setHeader:
            name: CamelAwsIAMPolicyArn
            constant: "arn:aws:iam::123456789012:policy/myPolicy"
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: detachRolePolicy

Instance Profile Operations

  • createInstanceProfile: this operation will create an instance profile in IAM

  • Java

  • XML

  • YAML

from("direct:createInstanceProfile")
    .setHeader("CamelAwsIAMInstanceProfileName", constant("myInstanceProfile"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=createInstanceProfile");
<route>
    <from uri="direct:createInstanceProfile"/>
    <setHeader name="CamelAwsIAMInstanceProfileName">
        <constant>myInstanceProfile</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=createInstanceProfile"/>
</route>
- route:
    from:
      uri: direct:createInstanceProfile
      steps:
        - setHeader:
            name: CamelAwsIAMInstanceProfileName
            constant: myInstanceProfile
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: createInstanceProfile
  • deleteInstanceProfile: this operation will delete an instance profile in IAM

  • Java

  • XML

  • YAML

from("direct:deleteInstanceProfile")
    .setHeader("CamelAwsIAMInstanceProfileName", constant("myInstanceProfile"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=deleteInstanceProfile");
<route>
    <from uri="direct:deleteInstanceProfile"/>
    <setHeader name="CamelAwsIAMInstanceProfileName">
        <constant>myInstanceProfile</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=deleteInstanceProfile"/>
</route>
- route:
    from:
      uri: direct:deleteInstanceProfile
      steps:
        - setHeader:
            name: CamelAwsIAMInstanceProfileName
            constant: myInstanceProfile
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: deleteInstanceProfile
  • getInstanceProfile: this operation will get an instance profile in IAM

  • Java

  • XML

  • YAML

from("direct:getInstanceProfile")
    .setHeader("CamelAwsIAMInstanceProfileName", constant("myInstanceProfile"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=getInstanceProfile");
<route>
    <from uri="direct:getInstanceProfile"/>
    <setHeader name="CamelAwsIAMInstanceProfileName">
        <constant>myInstanceProfile</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=getInstanceProfile"/>
</route>
- route:
    from:
      uri: direct:getInstanceProfile
      steps:
        - setHeader:
            name: CamelAwsIAMInstanceProfileName
            constant: myInstanceProfile
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: getInstanceProfile
  • listInstanceProfiles: this operation will list the instance profiles in IAM

  • Java

  • XML

  • YAML

from("direct:listInstanceProfiles")
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=listInstanceProfiles");
<route>
    <from uri="direct:listInstanceProfiles"/>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=listInstanceProfiles"/>
</route>
- route:
    from:
      uri: direct:listInstanceProfiles
      steps:
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: listInstanceProfiles
  • addRoleToInstanceProfile: this operation will add a role to an instance profile

  • Java

  • XML

  • YAML

from("direct:addRoleToInstanceProfile")
    .setHeader("CamelAwsIAMInstanceProfileName", constant("myInstanceProfile"))
    .setHeader("CamelAwsIAMRoleName", constant("myRole"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=addRoleToInstanceProfile");
<route>
    <from uri="direct:addRoleToInstanceProfile"/>
    <setHeader name="CamelAwsIAMInstanceProfileName">
        <constant>myInstanceProfile</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMRoleName">
        <constant>myRole</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=addRoleToInstanceProfile"/>
</route>
- route:
    from:
      uri: direct:addRoleToInstanceProfile
      steps:
        - setHeader:
            name: CamelAwsIAMInstanceProfileName
            constant: myInstanceProfile
        - setHeader:
            name: CamelAwsIAMRoleName
            constant: myRole
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: addRoleToInstanceProfile
  • removeRoleFromInstanceProfile: this operation will remove a role from an instance profile

  • Java

  • XML

  • YAML

from("direct:removeRoleFromInstanceProfile")
    .setHeader("CamelAwsIAMInstanceProfileName", constant("myInstanceProfile"))
    .setHeader("CamelAwsIAMRoleName", constant("myRole"))
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=removeRoleFromInstanceProfile");
<route>
    <from uri="direct:removeRoleFromInstanceProfile"/>
    <setHeader name="CamelAwsIAMInstanceProfileName">
        <constant>myInstanceProfile</constant>
    </setHeader>
    <setHeader name="CamelAwsIAMRoleName">
        <constant>myRole</constant>
    </setHeader>
    <to uri="aws2-iam://test?iamClient=#amazonIAMClient&amp;operation=removeRoleFromInstanceProfile"/>
</route>
- route:
    from:
      uri: direct:removeRoleFromInstanceProfile
      steps:
        - setHeader:
            name: CamelAwsIAMInstanceProfileName
            constant: myInstanceProfile
        - setHeader:
            name: CamelAwsIAMRoleName
            constant: myRole
        - to:
            uri: aws2-iam://test
            parameters:
              iamClient: "#amazonIAMClient"
              operation: removeRoleFromInstanceProfile

Using a POJO as body

Sometimes building an AWS Request can be complex because of multiple options. We introduce the possibility to use a POJO as a body. In AWS IAM, there are multiple operations you can submit, as an example for Create User request, you can do something like:

Java-only: requires AWS SDK builder
from("direct:createUser")
     .setBody(CreateUserRequest.builder().userName("camel").build())
    .to("aws2-iam://test?iamClient=#amazonIAMClient&operation=createUser&pojoRequest=true")

In this way, you’ll pass the request directly without the need of passing headers and options specifically related to this operation.

Dependencies

Maven users will need to add the following dependency to their pom.xml.

pom.xml

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-aws2-iam</artifactId>
    <version>${camel-version}</version>
</dependency>

where ${camel-version} must be replaced by the actual version of Camel.