This message was deleted.
# general
s
This message was deleted.
g
Cool... are you having issues or getting an error when doing this? Or do you have more general questions about doing this?
b
General questions 🙂 about how to do it ?
how do i get the vpc assigned to a new cluster instance ?
g
When you say "cluster instance", which resource type are you referring to? Do you mean
eks.NewCluster
?
b
aurora postgres cluster and cluster instance
iirc the lambdas need access to it, so i need to add the lambda to the vpc and security group
have done it manually through the dash to ensure it works, it worked
just don't know how to do it via pulumi
g
I see. If you are not providing a DB subnet group to your Aurora cluster or instance, then AWS will use the default VPC. You can use
LookupVpc
to query for the default VPC details. The LookupVpc documentation is here - https://www.pulumi.com/docs/reference/pkg/aws/ec2/getvpc/#using. And here's an example - https://github.com/pulumi/examples/blob/fd422a115ca1602eed9a895ab4ed748185d798cc/aws-go-eks/main.go#L18-L23.
b
Makes sense, if i was to create a vpc (which i probably should do per env) which of the returned properties correspond to the string db subnet group from here
Also how do i assign the lambdas access to the vpc ?
One last question for the night, in alot of the API to Get a resource (for instance
Copy code
// GetVpc gets an existing Vpc resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetVpc(ctx *pulumi.Context,
	name string, id pulumi.IDInput, state *VpcState, opts ...pulumi.ResourceOption) (*Vpc, error) {
	var resource Vpc
	err := ctx.ReadResource("aws:ec2/vpc:Vpc", name, id, state, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}
Where should I find the id from, I'll know the name beforehand (since i provide it on creation) but not the id
g
Makes sense, if i was to create a vpc (which i probably should do per env) which of the returned properties correspond to the string db subnet group from here
You would need to create a SubnetGroup as well and provide that to the Cluster and ClusterInstance resources - https://www.pulumi.com/docs/reference/pkg/aws/rds/subnetgroup/.
Where should I find the id from, I'll know the name beforehand (since i provide it on creation) but not the id
If you are creating the resource in your Pulumi application, then you would use
.ID()
off the resource that you created.
b
Thanks Cameron, all seems to be well !