5

I am using Jenkins Pipeline to publish a Visual Studio AWS Serverless .Net Core Application.

Can somebody tell me whether it is possible to add parameters to the serverless.template file? I would then be able to populate these parameters using the aws cli as part of the Jenkins build process.

For example if I wanted to publish to a staging environment with different VpcConfig values than the production environment;

"VpcConfig": {
        "SecurityGroupIds": [
            [PARAMETER_TO_BE_PASSED_IN_VIA_CLI]
        ],
        "SubnetIds": [
            [PARAMETER_TO_BE_PASSED_IN_VIA_CLI],
            [PARAMETER_TO_BE_PASSED_IN_VIA_CLI]
        ]
    }
markc
  • 51
  • 2

1 Answers1

0

Yes, we can define cloudfront aliases for dev, staging, prod and specify them under vpcConfig section.

Please find below code snippet

cloudfront:
  aliases:
    dev:
      - Fn::Join:
        - ''
        - - app-
          - 'dev'-
          - { Ref: AWS::AccountId }
          - .yourwebsite.com
    staging:
      - Fn::Join:
        - ''
        - - app-
          - 'staging'-
          - { Ref: AWS::AccountId } 
          - .yourwebsite.com
    prod:
      - yourwebsite.com
      - www.yourwebsite.com

and then mention them under vpcConfig section.

vpcConfig:
  dev:
    ${file(PathToSystem/vpcConfig.yml)}
  staging:
    ${file(PathToSystem/vpcConfig.yml)}
  prod:
    ${file(PathToSystem/vpcConfig.yml)}
Mahesh Waghmare
  • 726
  • 9
  • 27