aws.ssm.Activation
Explore with Pulumi AI
Registers an on-premises server or virtual machine with Amazon EC2 so that it can be managed using Run Command.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const assumeRole = aws.iam.getPolicyDocument({
statements: [{
effect: "Allow",
principals: [{
type: "Service",
identifiers: ["ssm.amazonaws.com"],
}],
actions: ["sts:AssumeRole"],
}],
});
const testRole = new aws.iam.Role("test_role", {
name: "test_role",
assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
});
const testAttach = new aws.iam.RolePolicyAttachment("test_attach", {
role: testRole.name,
policyArn: "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
});
const foo = new aws.ssm.Activation("foo", {
name: "test_ssm_activation",
description: "Test",
iamRole: testRole.id,
registrationLimit: 5,
}, {
dependsOn: [testAttach],
});
import pulumi
import pulumi_aws as aws
assume_role = aws.iam.get_policy_document(statements=[{
"effect": "Allow",
"principals": [{
"type": "Service",
"identifiers": ["ssm.amazonaws.com"],
}],
"actions": ["sts:AssumeRole"],
}])
test_role = aws.iam.Role("test_role",
name="test_role",
assume_role_policy=assume_role.json)
test_attach = aws.iam.RolePolicyAttachment("test_attach",
role=test_role.name,
policy_arn="arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore")
foo = aws.ssm.Activation("foo",
name="test_ssm_activation",
description="Test",
iam_role=test_role.id,
registration_limit=5,
opts = pulumi.ResourceOptions(depends_on=[test_attach]))
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Effect: pulumi.StringRef("Allow"),
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"ssm.amazonaws.com",
},
},
},
Actions: []string{
"sts:AssumeRole",
},
},
},
}, nil)
if err != nil {
return err
}
testRole, err := iam.NewRole(ctx, "test_role", &iam.RoleArgs{
Name: pulumi.String("test_role"),
AssumeRolePolicy: pulumi.String(assumeRole.Json),
})
if err != nil {
return err
}
testAttach, err := iam.NewRolePolicyAttachment(ctx, "test_attach", &iam.RolePolicyAttachmentArgs{
Role: testRole.Name,
PolicyArn: pulumi.String("arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"),
})
if err != nil {
return err
}
_, err = ssm.NewActivation(ctx, "foo", &ssm.ActivationArgs{
Name: pulumi.String("test_ssm_activation"),
Description: pulumi.String("Test"),
IamRole: testRole.ID(),
RegistrationLimit: pulumi.Int(5),
}, pulumi.DependsOn([]pulumi.Resource{
testAttach,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Effect = "Allow",
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"ssm.amazonaws.com",
},
},
},
Actions = new[]
{
"sts:AssumeRole",
},
},
},
});
var testRole = new Aws.Iam.Role("test_role", new()
{
Name = "test_role",
AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var testAttach = new Aws.Iam.RolePolicyAttachment("test_attach", new()
{
Role = testRole.Name,
PolicyArn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
});
var foo = new Aws.Ssm.Activation("foo", new()
{
Name = "test_ssm_activation",
Description = "Test",
IamRole = testRole.Id,
RegistrationLimit = 5,
}, new CustomResourceOptions
{
DependsOn =
{
testAttach,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import com.pulumi.aws.ssm.Activation;
import com.pulumi.aws.ssm.ActivationArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("ssm.amazonaws.com")
.build())
.actions("sts:AssumeRole")
.build())
.build());
var testRole = new Role("testRole", RoleArgs.builder()
.name("test_role")
.assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var testAttach = new RolePolicyAttachment("testAttach", RolePolicyAttachmentArgs.builder()
.role(testRole.name())
.policyArn("arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore")
.build());
var foo = new Activation("foo", ActivationArgs.builder()
.name("test_ssm_activation")
.description("Test")
.iamRole(testRole.id())
.registrationLimit("5")
.build(), CustomResourceOptions.builder()
.dependsOn(testAttach)
.build());
}
}
resources:
testRole:
type: aws:iam:Role
name: test_role
properties:
name: test_role
assumeRolePolicy: ${assumeRole.json}
testAttach:
type: aws:iam:RolePolicyAttachment
name: test_attach
properties:
role: ${testRole.name}
policyArn: arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
foo:
type: aws:ssm:Activation
properties:
name: test_ssm_activation
description: Test
iamRole: ${testRole.id}
registrationLimit: '5'
options:
dependson:
- ${testAttach}
variables:
assumeRole:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- effect: Allow
principals:
- type: Service
identifiers:
- ssm.amazonaws.com
actions:
- sts:AssumeRole
Create Activation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Activation(name: string, args: ActivationArgs, opts?: CustomResourceOptions);
@overload
def Activation(resource_name: str,
args: ActivationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Activation(resource_name: str,
opts: Optional[ResourceOptions] = None,
iam_role: Optional[str] = None,
description: Optional[str] = None,
expiration_date: Optional[str] = None,
name: Optional[str] = None,
registration_limit: Optional[int] = None,
tags: Optional[Mapping[str, str]] = None)
func NewActivation(ctx *Context, name string, args ActivationArgs, opts ...ResourceOption) (*Activation, error)
public Activation(string name, ActivationArgs args, CustomResourceOptions? opts = null)
public Activation(String name, ActivationArgs args)
public Activation(String name, ActivationArgs args, CustomResourceOptions options)
type: aws:ssm:Activation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ActivationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ActivationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ActivationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ActivationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ActivationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var activationResource = new Aws.Ssm.Activation("activationResource", new()
{
IamRole = "string",
Description = "string",
ExpirationDate = "string",
Name = "string",
RegistrationLimit = 0,
Tags =
{
{ "string", "string" },
},
});
example, err := ssm.NewActivation(ctx, "activationResource", &ssm.ActivationArgs{
IamRole: pulumi.String("string"),
Description: pulumi.String("string"),
ExpirationDate: pulumi.String("string"),
Name: pulumi.String("string"),
RegistrationLimit: pulumi.Int(0),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var activationResource = new Activation("activationResource", ActivationArgs.builder()
.iamRole("string")
.description("string")
.expirationDate("string")
.name("string")
.registrationLimit(0)
.tags(Map.of("string", "string"))
.build());
activation_resource = aws.ssm.Activation("activationResource",
iam_role="string",
description="string",
expiration_date="string",
name="string",
registration_limit=0,
tags={
"string": "string",
})
const activationResource = new aws.ssm.Activation("activationResource", {
iamRole: "string",
description: "string",
expirationDate: "string",
name: "string",
registrationLimit: 0,
tags: {
string: "string",
},
});
type: aws:ssm:Activation
properties:
description: string
expirationDate: string
iamRole: string
name: string
registrationLimit: 0
tags:
string: string
Activation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Activation resource accepts the following input properties:
- Iam
Role string - The IAM Role to attach to the managed instance.
- Description string
- The description of the resource that you want to register.
- Expiration
Date string - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- Name string
- The default name of the registered managed instance.
- Registration
Limit int - The maximum number of managed instances you want to register. The default value is 1 instance.
- Dictionary<string, string>
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- Iam
Role string - The IAM Role to attach to the managed instance.
- Description string
- The description of the resource that you want to register.
- Expiration
Date string - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- Name string
- The default name of the registered managed instance.
- Registration
Limit int - The maximum number of managed instances you want to register. The default value is 1 instance.
- map[string]string
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- iam
Role String - The IAM Role to attach to the managed instance.
- description String
- The description of the resource that you want to register.
- expiration
Date String - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- name String
- The default name of the registered managed instance.
- registration
Limit Integer - The maximum number of managed instances you want to register. The default value is 1 instance.
- Map<String,String>
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- iam
Role string - The IAM Role to attach to the managed instance.
- description string
- The description of the resource that you want to register.
- expiration
Date string - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- name string
- The default name of the registered managed instance.
- registration
Limit number - The maximum number of managed instances you want to register. The default value is 1 instance.
- {[key: string]: string}
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- iam_
role str - The IAM Role to attach to the managed instance.
- description str
- The description of the resource that you want to register.
- expiration_
date str - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- name str
- The default name of the registered managed instance.
- registration_
limit int - The maximum number of managed instances you want to register. The default value is 1 instance.
- Mapping[str, str]
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- iam
Role String - The IAM Role to attach to the managed instance.
- description String
- The description of the resource that you want to register.
- expiration
Date String - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- name String
- The default name of the registered managed instance.
- registration
Limit Number - The maximum number of managed instances you want to register. The default value is 1 instance.
- Map<String>
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Outputs
All input properties are implicitly available as output properties. Additionally, the Activation resource produces the following output properties:
- Activation
Code string - The code the system generates when it processes the activation.
- Expired bool
- If the current activation has expired.
- Id string
- The provider-assigned unique ID for this managed resource.
- Registration
Count int - The number of managed instances that are currently registered using this activation.
- Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Activation
Code string - The code the system generates when it processes the activation.
- Expired bool
- If the current activation has expired.
- Id string
- The provider-assigned unique ID for this managed resource.
- Registration
Count int - The number of managed instances that are currently registered using this activation.
- map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- activation
Code String - The code the system generates when it processes the activation.
- expired Boolean
- If the current activation has expired.
- id String
- The provider-assigned unique ID for this managed resource.
- registration
Count Integer - The number of managed instances that are currently registered using this activation.
- Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- activation
Code string - The code the system generates when it processes the activation.
- expired boolean
- If the current activation has expired.
- id string
- The provider-assigned unique ID for this managed resource.
- registration
Count number - The number of managed instances that are currently registered using this activation.
- {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- activation_
code str - The code the system generates when it processes the activation.
- expired bool
- If the current activation has expired.
- id str
- The provider-assigned unique ID for this managed resource.
- registration_
count int - The number of managed instances that are currently registered using this activation.
- Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- activation
Code String - The code the system generates when it processes the activation.
- expired Boolean
- If the current activation has expired.
- id String
- The provider-assigned unique ID for this managed resource.
- registration
Count Number - The number of managed instances that are currently registered using this activation.
- Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
Look up Existing Activation Resource
Get an existing Activation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ActivationState, opts?: CustomResourceOptions): Activation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
activation_code: Optional[str] = None,
description: Optional[str] = None,
expiration_date: Optional[str] = None,
expired: Optional[bool] = None,
iam_role: Optional[str] = None,
name: Optional[str] = None,
registration_count: Optional[int] = None,
registration_limit: Optional[int] = None,
tags: Optional[Mapping[str, str]] = None,
tags_all: Optional[Mapping[str, str]] = None) -> Activation
func GetActivation(ctx *Context, name string, id IDInput, state *ActivationState, opts ...ResourceOption) (*Activation, error)
public static Activation Get(string name, Input<string> id, ActivationState? state, CustomResourceOptions? opts = null)
public static Activation get(String name, Output<String> id, ActivationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Activation
Code string - The code the system generates when it processes the activation.
- Description string
- The description of the resource that you want to register.
- Expiration
Date string - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- Expired bool
- If the current activation has expired.
- Iam
Role string - The IAM Role to attach to the managed instance.
- Name string
- The default name of the registered managed instance.
- Registration
Count int - The number of managed instances that are currently registered using this activation.
- Registration
Limit int - The maximum number of managed instances you want to register. The default value is 1 instance.
- Dictionary<string, string>
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Activation
Code string - The code the system generates when it processes the activation.
- Description string
- The description of the resource that you want to register.
- Expiration
Date string - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- Expired bool
- If the current activation has expired.
- Iam
Role string - The IAM Role to attach to the managed instance.
- Name string
- The default name of the registered managed instance.
- Registration
Count int - The number of managed instances that are currently registered using this activation.
- Registration
Limit int - The maximum number of managed instances you want to register. The default value is 1 instance.
- map[string]string
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- activation
Code String - The code the system generates when it processes the activation.
- description String
- The description of the resource that you want to register.
- expiration
Date String - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- expired Boolean
- If the current activation has expired.
- iam
Role String - The IAM Role to attach to the managed instance.
- name String
- The default name of the registered managed instance.
- registration
Count Integer - The number of managed instances that are currently registered using this activation.
- registration
Limit Integer - The maximum number of managed instances you want to register. The default value is 1 instance.
- Map<String,String>
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- activation
Code string - The code the system generates when it processes the activation.
- description string
- The description of the resource that you want to register.
- expiration
Date string - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- expired boolean
- If the current activation has expired.
- iam
Role string - The IAM Role to attach to the managed instance.
- name string
- The default name of the registered managed instance.
- registration
Count number - The number of managed instances that are currently registered using this activation.
- registration
Limit number - The maximum number of managed instances you want to register. The default value is 1 instance.
- {[key: string]: string}
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- activation_
code str - The code the system generates when it processes the activation.
- description str
- The description of the resource that you want to register.
- expiration_
date str - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- expired bool
- If the current activation has expired.
- iam_
role str - The IAM Role to attach to the managed instance.
- name str
- The default name of the registered managed instance.
- registration_
count int - The number of managed instances that are currently registered using this activation.
- registration_
limit int - The maximum number of managed instances you want to register. The default value is 1 instance.
- Mapping[str, str]
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- activation
Code String - The code the system generates when it processes the activation.
- description String
- The description of the resource that you want to register.
- expiration
Date String - UTC timestamp in RFC3339 format by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
- expired Boolean
- If the current activation has expired.
- iam
Role String - The IAM Role to attach to the managed instance.
- name String
- The default name of the registered managed instance.
- registration
Count Number - The number of managed instances that are currently registered using this activation.
- registration
Limit Number - The maximum number of managed instances you want to register. The default value is 1 instance.
- Map<String>
- A map of tags to assign to the object. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
Import
Using pulumi import
, import AWS SSM Activation using the id
. For example:
$ pulumi import aws:ssm/activation:Activation example e488f2f6-e686-4afb-8a04-ef6dfEXAMPLE
-> Note: The activation_code
attribute cannot be imported.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.