Try AWS Native preview for resources not in the classic version.
aws.ec2.AmiLaunchPermission
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Adds a launch permission to an Amazon Machine Image (AMI).
Example Usage
AWS Account ID
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.AmiLaunchPermission("example", new()
{
AccountId = "123456789012",
ImageId = "ami-12345678",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewAmiLaunchPermission(ctx, "example", &ec2.AmiLaunchPermissionArgs{
AccountId: pulumi.String("123456789012"),
ImageId: pulumi.String("ami-12345678"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.AmiLaunchPermission;
import com.pulumi.aws.ec2.AmiLaunchPermissionArgs;
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) {
var example = new AmiLaunchPermission("example", AmiLaunchPermissionArgs.builder()
.accountId("123456789012")
.imageId("ami-12345678")
.build());
}
}
import pulumi
import pulumi_aws as aws
example = aws.ec2.AmiLaunchPermission("example",
account_id="123456789012",
image_id="ami-12345678")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.AmiLaunchPermission("example", {
accountId: "123456789012",
imageId: "ami-12345678",
});
resources:
example:
type: aws:ec2:AmiLaunchPermission
properties:
accountId: '123456789012'
imageId: ami-12345678
Public Access
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.AmiLaunchPermission("example", new()
{
Group = "all",
ImageId = "ami-12345678",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewAmiLaunchPermission(ctx, "example", &ec2.AmiLaunchPermissionArgs{
Group: pulumi.String("all"),
ImageId: pulumi.String("ami-12345678"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.AmiLaunchPermission;
import com.pulumi.aws.ec2.AmiLaunchPermissionArgs;
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) {
var example = new AmiLaunchPermission("example", AmiLaunchPermissionArgs.builder()
.group("all")
.imageId("ami-12345678")
.build());
}
}
import pulumi
import pulumi_aws as aws
example = aws.ec2.AmiLaunchPermission("example",
group="all",
image_id="ami-12345678")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.AmiLaunchPermission("example", {
group: "all",
imageId: "ami-12345678",
});
resources:
example:
type: aws:ec2:AmiLaunchPermission
properties:
group: all
imageId: ami-12345678
Organization Access
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var current = Aws.Organizations.GetOrganization.Invoke();
var example = new Aws.Ec2.AmiLaunchPermission("example", new()
{
ImageId = "ami-12345678",
OrganizationArn = current.Apply(getOrganizationResult => getOrganizationResult.Arn),
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
current, err := organizations.LookupOrganization(ctx, nil, nil)
if err != nil {
return err
}
_, err = ec2.NewAmiLaunchPermission(ctx, "example", &ec2.AmiLaunchPermissionArgs{
ImageId: pulumi.String("ami-12345678"),
OrganizationArn: *pulumi.String(current.Arn),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.organizations.OrganizationsFunctions;
import com.pulumi.aws.ec2.AmiLaunchPermission;
import com.pulumi.aws.ec2.AmiLaunchPermissionArgs;
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 current = OrganizationsFunctions.getOrganization();
var example = new AmiLaunchPermission("example", AmiLaunchPermissionArgs.builder()
.imageId("ami-12345678")
.organizationArn(current.applyValue(getOrganizationResult -> getOrganizationResult.arn()))
.build());
}
}
import pulumi
import pulumi_aws as aws
current = aws.organizations.get_organization()
example = aws.ec2.AmiLaunchPermission("example",
image_id="ami-12345678",
organization_arn=current.arn)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const current = aws.organizations.getOrganization({});
const example = new aws.ec2.AmiLaunchPermission("example", {
imageId: "ami-12345678",
organizationArn: current.then(current => current.arn),
});
resources:
example:
type: aws:ec2:AmiLaunchPermission
properties:
imageId: ami-12345678
organizationArn: ${current.arn}
variables:
current:
fn::invoke:
Function: aws:organizations:getOrganization
Arguments: {}
Create AmiLaunchPermission Resource
new AmiLaunchPermission(name: string, args: AmiLaunchPermissionArgs, opts?: CustomResourceOptions);
@overload
def AmiLaunchPermission(resource_name: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
group: Optional[str] = None,
image_id: Optional[str] = None,
organization_arn: Optional[str] = None,
organizational_unit_arn: Optional[str] = None)
@overload
def AmiLaunchPermission(resource_name: str,
args: AmiLaunchPermissionArgs,
opts: Optional[ResourceOptions] = None)
func NewAmiLaunchPermission(ctx *Context, name string, args AmiLaunchPermissionArgs, opts ...ResourceOption) (*AmiLaunchPermission, error)
public AmiLaunchPermission(string name, AmiLaunchPermissionArgs args, CustomResourceOptions? opts = null)
public AmiLaunchPermission(String name, AmiLaunchPermissionArgs args)
public AmiLaunchPermission(String name, AmiLaunchPermissionArgs args, CustomResourceOptions options)
type: aws:ec2:AmiLaunchPermission
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AmiLaunchPermissionArgs
- 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 AmiLaunchPermissionArgs
- 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 AmiLaunchPermissionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AmiLaunchPermissionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AmiLaunchPermissionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
AmiLaunchPermission Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The AmiLaunchPermission resource accepts the following input properties:
- Image
Id string ID of the AMI.
- Account
Id string AWS account ID for the launch permission.
- Group string
Name of the group for the launch permission. Valid values:
"all"
.- Organization
Arn string ARN of an organization for the launch permission.
- Organizational
Unit stringArn ARN of an organizational unit for the launch permission.
- Image
Id string ID of the AMI.
- Account
Id string AWS account ID for the launch permission.
- Group string
Name of the group for the launch permission. Valid values:
"all"
.- Organization
Arn string ARN of an organization for the launch permission.
- Organizational
Unit stringArn ARN of an organizational unit for the launch permission.
- image
Id String ID of the AMI.
- account
Id String AWS account ID for the launch permission.
- group String
Name of the group for the launch permission. Valid values:
"all"
.- organization
Arn String ARN of an organization for the launch permission.
- organizational
Unit StringArn ARN of an organizational unit for the launch permission.
- image
Id string ID of the AMI.
- account
Id string AWS account ID for the launch permission.
- group string
Name of the group for the launch permission. Valid values:
"all"
.- organization
Arn string ARN of an organization for the launch permission.
- organizational
Unit stringArn ARN of an organizational unit for the launch permission.
- image_
id str ID of the AMI.
- account_
id str AWS account ID for the launch permission.
- group str
Name of the group for the launch permission. Valid values:
"all"
.- organization_
arn str ARN of an organization for the launch permission.
- organizational_
unit_ strarn ARN of an organizational unit for the launch permission.
- image
Id String ID of the AMI.
- account
Id String AWS account ID for the launch permission.
- group String
Name of the group for the launch permission. Valid values:
"all"
.- organization
Arn String ARN of an organization for the launch permission.
- organizational
Unit StringArn ARN of an organizational unit for the launch permission.
Outputs
All input properties are implicitly available as output properties. Additionally, the AmiLaunchPermission resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing AmiLaunchPermission Resource
Get an existing AmiLaunchPermission 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?: AmiLaunchPermissionState, opts?: CustomResourceOptions): AmiLaunchPermission
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
group: Optional[str] = None,
image_id: Optional[str] = None,
organization_arn: Optional[str] = None,
organizational_unit_arn: Optional[str] = None) -> AmiLaunchPermission
func GetAmiLaunchPermission(ctx *Context, name string, id IDInput, state *AmiLaunchPermissionState, opts ...ResourceOption) (*AmiLaunchPermission, error)
public static AmiLaunchPermission Get(string name, Input<string> id, AmiLaunchPermissionState? state, CustomResourceOptions? opts = null)
public static AmiLaunchPermission get(String name, Output<String> id, AmiLaunchPermissionState 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.
- Account
Id string AWS account ID for the launch permission.
- Group string
Name of the group for the launch permission. Valid values:
"all"
.- Image
Id string ID of the AMI.
- Organization
Arn string ARN of an organization for the launch permission.
- Organizational
Unit stringArn ARN of an organizational unit for the launch permission.
- Account
Id string AWS account ID for the launch permission.
- Group string
Name of the group for the launch permission. Valid values:
"all"
.- Image
Id string ID of the AMI.
- Organization
Arn string ARN of an organization for the launch permission.
- Organizational
Unit stringArn ARN of an organizational unit for the launch permission.
- account
Id String AWS account ID for the launch permission.
- group String
Name of the group for the launch permission. Valid values:
"all"
.- image
Id String ID of the AMI.
- organization
Arn String ARN of an organization for the launch permission.
- organizational
Unit StringArn ARN of an organizational unit for the launch permission.
- account
Id string AWS account ID for the launch permission.
- group string
Name of the group for the launch permission. Valid values:
"all"
.- image
Id string ID of the AMI.
- organization
Arn string ARN of an organization for the launch permission.
- organizational
Unit stringArn ARN of an organizational unit for the launch permission.
- account_
id str AWS account ID for the launch permission.
- group str
Name of the group for the launch permission. Valid values:
"all"
.- image_
id str ID of the AMI.
- organization_
arn str ARN of an organization for the launch permission.
- organizational_
unit_ strarn ARN of an organizational unit for the launch permission.
- account
Id String AWS account ID for the launch permission.
- group String
Name of the group for the launch permission. Valid values:
"all"
.- image
Id String ID of the AMI.
- organization
Arn String ARN of an organization for the launch permission.
- organizational
Unit StringArn ARN of an organizational unit for the launch permission.
Import
AMI Launch Permissions can be imported using [ACCOUNT-ID|GROUP-NAME|ORGANIZATION-ARN|ORGANIZATIONAL-UNIT-ARN]/IMAGE-ID
, e.g.,
$ pulumi import aws:ec2/amiLaunchPermission:AmiLaunchPermission example 123456789012/ami-12345678
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.