https://pulumi.com logo
#aws
Title
# aws
m

millions-market-17062

01/11/2021, 1:35 PM
Hey, Trying to spin up EKS Getting this error
Copy code
error: aws:ec2/launchConfiguration:LaunchConfiguration resource 'eks-matan-ng1-nodeLaunchConfiguration' has a problem: Attribute must be a single value, not a list
b

brave-planet-10645

01/11/2021, 1:45 PM
Can you provide some code so we can see what's going on?
m

millions-market-17062

01/11/2021, 1:48 PM
Copy code
"use strict";
const pulumi = require("@pulumi/pulumi");
const aws = require("@pulumi/aws");
const awsx = require("@pulumi/awsx");
const eks = require("@pulumi/eks");
const kubernetes = require("@pulumi/kubernetes");

const name = "eks-matan";

// Create an EKS cluster with non-default configuration
const vpc = new awsx.ec2.Vpc("vpc-eks-matan",
    { subnets: [{ type: "public" },{ type: "private"}],
        cidrBlock: "10.20.0.0/16",
        tags: [{ test: "matan" }]});

const cluster = new eks.Cluster(name, {
    vpcId: vpc.id,
    subnetIds: vpc.privateSubnetIds,
    storageClasses: "gp2",
    nodeAssociatePublicIpAddress: false,
    skipDefaultNodeGroup: true,
});

const fixedNodeGroup = cluster.createNodeGroup("eks-matan-ng1", {
    instanceType: "t2.medium",
    desiredCapacity: 1,
    minSize: 1,
    maxSize: 2,
    labels: {"ondemand": "true"},
    instanceProfile: cluster.instanceRoles
});

const spotNodeGroup = new eks.NodeGroup("eks-matan-ng2", {
    cluster: cluster,
    instanceType: "t2.medium",
    desiredCapacity: 1,
    spotPrice: "1",
    minSize: 1,
    maxSize: 2,
    labels: {"preemptible": "true"},
    instanceProfile: cluster.instanceRoles,
    taints: {
        "special": {
            value: "true",
            effect: "NoSchedule",
        },
    },
}, {
    providers: { kubernetes: cluster.provider},
});

exports.kubeconfig = cluster.kubeconfig;
exports.fixedNodeGroup = fixedNodeGroup;
exports.spotNodeGroup = spotNodeGroup;
exports.vpc = vpc;
c

cool-fireman-90027

01/11/2021, 5:49 PM
Hi @millions-market-17062, Here is what I got with the code you provided. • changed the top block from require to imports • updated the format of the tag • created an instanceProfile from the role since I didn’t have anything to pass in Optimization that will help you in the long run below: • I updated the instanceTypes here and here because these are newer and cheaper ec2 instances. You can see that here • I changed the spot price to
0.05
instead of $1.00. Here is Pulumi.dev.yaml where I set the aws region. Let me know if you have any more questions.
m

millions-market-17062

01/12/2021, 8:57 AM
This is very detailed. Much appreciated!
Regarding the yaml. How do I move all of the variables in there? Like, Name of the NodeGroup and cluster name?
c

cool-fireman-90027

01/12/2021, 12:44 PM
So you would want to use pulumi config set aws:region us-east-2 or pulumi config set myname mykubercluster
Here are all the things you can do with pulumi config
m

millions-market-17062

01/12/2021, 2:43 PM
I mean I would like to move the cluster name to the config. Is this where it belong or should I put it in a different file?
c

cool-fireman-90027

01/12/2021, 4:59 PM
You can do this:
pulumi config set cluster_name REPLACEWITHYOURNAME
pulumi config
Copy code
KEY           VALUE
aws:region    us-east-2
cluster_name  shaht
Then when you do
pulumi up
you will have an ekscluster with the name of
shaht-eksCluster-182169f
https://share.getcloudapp.com/d5uPd4br Here is where the code takes in the name. This is where the cluster name is set The cluster takes the name that you passed in and adds does auto-naming.
m

millions-market-17062

01/13/2021, 8:36 AM
Great! Thanks
I’m not sure is the config the right place to put everything? For example: CIDR, Public / Private subnets.. Can I use the config to put a value of JSON>?
c

cool-fireman-90027

01/13/2021, 1:46 PM
Here is an example of having things in pulumi config, creating stackreferences, and then using them in a different pulumi project to stand up ecs. The second project also uses configs. So you can mix and match what you want. you can use pulumi config set to put a value of json.
m

millions-market-17062

01/14/2021, 8:48 AM
Thank you
2 Views