Activation class
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: [{
principals: [{
type: "Service",
identifiers: ["ssm.amazonaws.com"],
}],
effect: "Allow",
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=[{
"principals": [{
"type": "Service",
"identifiers": ["ssm.amazonaws.com"],
}],
"effect": "Allow",
"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]))
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
{
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"ssm.amazonaws.com",
},
},
},
Effect = "Allow",
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 main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v7/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{
{
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"ssm.amazonaws.com",
},
},
},
Effect: pulumi.StringRef("Allow"),
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().ToIDOutput().ToStringOutput(),
RegistrationLimit: pulumi.Int(5),
}, pulumi.DependsOn([]pulumi.Resource{
testAttach,
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_iam_getpolicydocument" "assumeRole" {
statements {
principals {
type = "Service"
identifiers = ["ssm.amazonaws.com"]
}
effect = "Allow"
actions = ["sts:AssumeRole"]
}
}
resource "aws_iam_role" "test_role" {
name = "test_role"
assume_role_policy = data.aws_iam_getpolicydocument.assumeRole.json
}
resource "aws_iam_rolepolicyattachment" "test_attach" {
role = aws_iam_role.test_role.name
policy_arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
}
resource "aws_ssm_activation" "foo" {
depends_on = [aws_iam_rolepolicyattachment.test_attach]
name = "test_ssm_activation"
description = "Test"
iam_role = aws_iam_role.test_role.id
registration_limit = "5"
}
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.inputs.GetPolicyDocumentStatementArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
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.ArrayList;
import java.util.Arrays;
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()
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("ssm.amazonaws.com")
.build())
.effect("Allow")
.actions("sts:AssumeRole")
.build())
.build());
var testRole = new Role("testRole", RoleArgs.builder()
.name("test_role")
.assumeRolePolicy(assumeRole.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:
- principals:
- type: Service
identifiers:
- ssm.amazonaws.com
effect: Allow
actions:
- sts:AssumeRole
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 activationCode attribute cannot be imported.
Constructors
- Activation(String name, {ActivationArgs? args, CustomResourceOptions? options})
-
Creates a new Activation.
nameThe Pulumi resource name.argsArguments used to configure this Activation. The set of arguments for Activation.optionsResource options controlling this resource's behavior. - Activation.reference(String urn)
- Creates a typed reference to an existing Activation resource.
Properties
-
activationCode
↔ Output<
String> -
The code the system generates when it processes the activation.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
description
↔ Output<
String?> -
The description of the resource that you want to register.
latefinal
-
expirationDate
↔ Output<
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.
latefinal
-
expired
↔ Output<
bool> -
If the current activation has expired.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
iamRole
↔ Output<
String> -
The IAM Role to attach to the managed instance.
latefinal
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
The default name of the registered managed instance.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
registrationCount
↔ Output<
int> -
The number of managed instances that are currently registered using this activation.
latefinal
-
registrationLimit
↔ Output<
int?> -
The maximum number of managed instances you want to register. The default value is 1 instance.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
A map of tags to assign to the object. .If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {ActivationState? state, CustomResourceOptions? options}) → Activation -
Gets an existing Activation resource's state with the given
nameandid.