By using AWS re:Post, you agree to the Terms of Use

Questions tagged with AWS Command Line Interface

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Aws CodePipeline to Deploy to ECS Cluster using AWS CLI

I am using AWS CodePipeline to create a CICD. I am using Bitbucket as a source, using CodeBuid and Amazon CodePipeline. I have done this using console but now I want to create CodePipeline using AWS CLI. For this, we have to create a JSON file that holds the configuration. I want to deploy my application to ECS but I don't find any JSON format to do this. Here you can see the JSON file: ``` { "pipeline": { "roleArn": "arn:aws:iam::74555555530:role/service-role/AWSCodePipelineServiceRole-us-east-1-HubspotConnector", "stages": [ { "Name": "Source", "Actions": [ { "InputArtifacts": [], "ActionTypeId": { "Version": "1", "Owner": "AWS", "Category": "Source", "Provider": "CodeStarSourceConnection" }, "OutputArtifacts": [ { "Name": "SourceArtifact" } ], "RunOrder": 1, "Configuration": { "ConnectionArn": "arn:aws:codestar-connections:us-east-1:747926693930:connection/5b2xxxx2-2xxf-4xx0-9xx3-xxcfxxxxx72f", "FullRepositoryId": "an-c/rpipeline", "BranchName": "xxxxxx", "OutputArtifactFormat": "CODE_ZIP" }, "Name": "ApplicationSource" } ] }, { "name": "Build", "actions": [ { "inputArtifacts": [ { "name": "SourceArtifact" } ], "name": "Build", "actionTypeId": { "category": "Build", "owner": "AWS", "version": "1", "provider": "CodeBuild" }, "outputArtifacts": [ { "name": "default" } ], "configuration": { "ProjectName": "cicdCli" }, "runOrder": 1 } ] } ], "artifactStore": { "type": "S3", "location": "codepipeline-us-east-1-16896969692329" }, "name": "newPipelineCicd", "version": 1 } } ``` It has source stage, build stage but I don't know how to write build stage (for Deploy to ECS). Can someone guide me what are the exact parameters for build stage (ECS deployment).
1
answers
0
votes
47
views
asked 12 days ago

CodeBuild Bug? AWS CLI broken on AL2/aarch64 env, error "pyenv: version `3.9.7' is not installed"

## Summary: On CodeBuild projects running on AL2/aarch64, running the `aws` CLI command (any command works, I use `--version` as a sanity check) yields the following error: ``` [Container] 2022/09/10 02:39:37 Running command aws --version pyenv: version `3.9.7' is not installed (set by /codebuild/output/src576940877/src/.python-version) ``` The process exits with status code 1 and the build terminates. I can reproduce the error exactly on my M1 MBP running locally, following the instructions for local agent usage [here](https://docs.aws.amazon.com/codebuild/latest/userguide/use-codebuild-agent.html). ## Steps to Reproduce 1. Create minimal buildspec.yml: ```yml version: 0.2 phases: build: commands: - aws --version ``` 2. Launch on CodeBuild project set to AL2/aarch64, on SMALL size build. ## Expected behavior Build should pass. Output of command should be: ``` [Container] 2022/09/10 03:00:41 Running command /usr/local/bin/aws --version aws-cli/2.7.31 Python/3.9.11 Linux/5.10.104-linuxkit exe/aarch64.amzn.2 prompt/off ``` ## Actual behavior Output is actually: ``` [Container] 2022/09/10 02:39:37 Running command aws --version pyenv: version `3.9.7' is not installed (set by /codebuild/output/src576940877/src/.python-version) ``` ## Workaround The AWS CLI can be installed manually and run via direct path: ``` version: 0.2 phases: install: runtime-versions: python: 3.9 commands: - curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" - unzip awscliv2.zip - ./aws/install build: commands: - /usr/local/bin/aws --version ``` This produces the expected output and the build succeeds.
0
answers
0
votes
20
views
asked 16 days ago

sam build using docker image fails when .git is included.

## Detail I used "sam init" to create a hello-world (docker image). Then I tried "sam build" and it completed successfully. Then I connected git (code-commit) and ran "sam build" again and it failed. (At this point, the Image is created, but if I ran "sam deploy" it failed.) Same with using the option "--no-cached". Then I deleted ".git" and ran "sam build" again and it worked. ("sam deploy" also works fine.) Is this a bug? Or is the specification that git cannot be used with sam? ## Environment * Windows10 (64bit) * Python 3.9 * sam hello-world (Node16, Image) * PowerShell / cmd.exe * Docker Desktop (WSL2) ## Dir and files <project dir> * .git * events * hello-world * .gitignore * README.md * template.yaml ## Error message ``` ︙ Build Succeeded Built Artifacts : .aws-sam\build Built Template : .aws-sam\build\template.yaml Commands you can use next ========================= [*] Validate SAM template: sam validate [*] Invoke Function: sam local invoke [*] Test Function in the Cloud: sam sync --stack-name {stack-name} --watch [*] Deploy: sam deploy --guided Traceback (most recent call last): File "runpy.py", line 194, in _run_module_as_main File "runpy.py", line 87, in _run_code File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\__main__.py", line 12, in <module> cli(prog_name="sam") File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 829, in __call__ return self.main(*args, **kwargs) File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 782, in main rv = self.invoke(ctx) File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 610, in invoke return callback(*args, **kwargs) File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\decorators.py", line 73, in new_func return ctx.invoke(f, obj, *args, **kwargs) File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 610, in invoke return callback(*args, **kwargs) File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metric.py", line 166, in wrapped metric_specific_attributes["gitOrigin"] = get_git_remote_origin_url() File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\project_metadata.py", line 34, in get_git_remote_origin_url metadata = _parse_remote_origin_url(str(runcmd.stdout)) File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\project_metadata.py", line 104, in _parse_remote_origin_url return [str(item) for item in pattern.findall(url)[0]] IndexError: list index out of range ```
1
answers
0
votes
45
views
asked 21 days ago